Reputation: 13
Im using notepad++ and i have a have large text file with lots of lines that all contain a string with no spaces, I need a way to remove all lines that occur more than once.
For example:
name1
name1
name2
name3
name4
name4
name5
Would be changed to
name2
name3
name5
Upvotes: 1
Views: 1250
Reputation: 16043
Search for ^(.*?\R)\1+
and replace with nothing.
From start of line ^
, find all characters .*?
until the linebreak \R
. Then repeat \1
the search from ()
one or more times +
.
Use regular expression search mode.
Lines must be sorted before doing this.
Last line must end with linebreak, or it will not be matched.
Upvotes: 1