i have this data
aaa
aaa
bbb
ddd
bbb
ccc
how to keep only unique lines as this result
ddd
ccc
Thanks much for any help
i have this data
aaa
aaa
bbb
ddd
bbb
ccc
how to keep only unique lines as this result
ddd
ccc
Thanks much for any help
Try doing a find and replace all in regex mode with:
^(.*?\R)\1+
and replace with nothing.
Apologies, just observed this will not work is list is not sorted.
Two step
1st : Edit - Line Operations - Sort Lines Lexicographically Ascending
2nd : replace "(?-s)^(.+\R)\1+" with nothing
source :https://notepad-plus-plus.org/community/topic/12490/i-want-to-keep-only-unique-lines/2
Anyone can explain the answer ? .Thanks
For anyone still ending up here, you can now do:
Select text to operate on
Edit->Line Operations->Sort Lines Lexicographically Ascending
Edit->Line Operations->Remove Consecutive Duplicate Lines
user3528679's answer works, except there's one correction in the second step.
For the regex find and replace, do not replace with nothing/blank, instead replace with the captured string in the capture group (replace with $1)
The regex selects a group of one or more consecutive duplicates. Replacement with $1 will replace the whole group with the captured string.