Text Files contain duplicated lines or rows, How to delete the duplicate rows

This post explains shows multiple ways to remove duplicate lines in a file opened in Notepad++. one way using Inbuilt Line operations, second way Find and replace using regular expression. the third way, using the text fx plugin. For example, File content the following content

This is test content
This is test content4
This is test content5
This is test content
This is test content
This is test content

How to remove duplicate lines in Notepad++

Open Notepadd++ from the command line or use GUI Open the text or coding file in notepad++ editor

  • using line operations Notepad++ provides Inbuilt Line operations features.

    • Select Edit > Line Operation > Remove Duplicate Lines

      It removes the duplicate lines and output in the file.
      
      ```markup
      This is test content
      This is test content4
      This is test content5
      ```
      
  • Select Edit > Line Operation > Remove Consequitive Duplicate Lines

It removes the Consecutive duplicate lines and output in the file.

        This is test content
        This is test content4
        This is test content5
        This is test content
  • using Regular express Find and Replace

Go to search menu > select Replace Menu item, or use shortcut (Ctrl + H) It opens the Find and Replaces window

Type Find What search box

^(.*)(\r?\n\1)+$

type Replace with

$1

next, click the Replace button and consecutive duplicate lines or rows remove from the file.

  • textfx plugin

Download textfx plugin from here

  • It downloads ZIP file and extracts the file(NppTextFX.dll) into Notepad++/plugins folder
  • Restart Notepad++ and It shows TextFS in the menu
  • You can compare the files