Text Files contain duplicated lines or rows, How to delete the duplicate rows
This post explains multiple ways to remove duplicate lines in a file opened in Notepad++. One way using Inbuilt Line operations
, second way is 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 the 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.
- Select
This is test content
This is test content4
This is test content5
- Select
Edit
>Line Operation
>Remove Consecutive 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 the shortcut (Ctrl
+ H
)
It opens the Find and Replaces window
Type the Find What
search box
^(.*)(\r?\n\1)+$
type Replace with
$1
next, click the Replace
button and
consecutive duplicate lines or rows removed 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