Find duplicates and delete all in notepad++

example:epshetsky@test.com,
rek4@test.com,
rajesh1239@test.com,
mohanraj@test.com,
sam@test.com,
nithin@test.com,
midhunvintech@test.com,
karthickgm27@test.com,
rajesh1239@test.com,
mohanraj@test.com,
nithin@test.com,

I need results back like

epshetsky@test.com,
rek4@test.com,
sam@test.com,
nithin@test.com,
midhunvintech@test.com,
karthickgm27@test.com,

 

  1. sort line with Edit -> Line Operations -> Sort Lines Lexicographically ascending
  2. do a Find / Replace:
    • Find What: ^(.*\r?\n)\1+
    • Replace with: (Nothing, leave empty)
    • Check Regular Expression in the lower left
    • Click Replace All

How it works: The sorting puts the duplicates behind each other. The find matches a line ^(.*\r?\n) and captures the line in \1 then it continues and tries to find \1 one or more times (+) behind the first match. Such a block of duplicates (if it exists) is replaced with nothing.

The \r?\n should deal nicely with Windows and Unix lineendings.

 

https://stackoverflow.com/questions/35329122/find-duplicates-and-delete-all-in-notepad

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *