Find duplicate lines and delete both lines

Tool for Search and Replace across multiple files.
Post Reply
53cricketballs
Posts: 1
Joined: Mon Mar 19, 2018 3:10 am

Find duplicate lines and delete both lines

Post by 53cricketballs »

Hello, I would like to know if textcrawler is able to find duplicate lines in a text file and delete both lines?

ie:

12345
12345
67890

would become

67890


TIA
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Find duplicate lines and delete both lines

Post by DigitalVolcano »

You can use this providing the duplicate lines are next to each other:

Code: Select all

^(.*)(\r?\n\1)+$
Replacing with nothing will delete both lines.
Post Reply