removing duplicate lines
Robert Mundkowsky last edited by
Can someone add “remove duplicate lines” as a menu option function?
TextFX plugin used to do this, but it seems was not updated to support 64 bit version of Notepad++.
Also I see a lot of answers saying go use regular expressions, but this is a very common operation I have used a lot and it is huge pain to go figure out a valid regular expression for this every time.
Seems like this has been requested more than once by others as well.
Hopefully thanks in advance.
Scott Sumner last edited by
What I’ve done is to record a macro for the regular expression search and replace for this. That gets rid of the “huge pain” to dig up the regular expression each time. Perhaps you will find value in doing the same. It may never become a built-in command; the developers don’t seem to build in functionality that can be accomplished in other ways (regex search and replace, plug-in, etc).
guy038 last edited by guy038
Hello, Robert Mundkowsky and Scott,
Nevertheless, the Notepad2 editor, for instance, has features for keeping only unique or multiple lines, while doing sort !!
( Select some text, in Notepad2 and hit the
ALT + Oshorcut to open the sort dialog )
Here are, below, two useful links, on how to realize such operations, with the help of the N++ regex and sort features :
The first one gives you two solutions ( WITH or WITHOUT change of the file’s content’s ) to ONLY keep :
All the unique lines
All the duplicate lines
The first item of all the duplicate lines
The second one gives you a method ( WITHOUT change of the natural order of the file’s contents ) to ONLY keep :
- All the unique lines AND the last item of all the duplicate lines,
I’m, still, studying these questions, presently ! I’ll, also, try to see if these operations could be easily inserted in macros !
So, see you later, for some updates :-))