^(.\*)$\n\1
replace with:
$1
This tells jEdit to
- start at the beginning of a line ^
- find any characters, spaces, etc .*
- up to the end of the line $
- including a carriage return \n
- that matches the text on the following line \1
- then replace it with just the first matched line $1
The result is any lines that are duplicated will be replaced with just a single copy of the line.
Cool! :)
ReplyDeleteI just had to remove "\" before "*", so my pattern changed to ^(.*)$\n\1 . Looks like a typo or maybe some tool's initiative... :)
And in case duplicates are there in more than one copy, it is possible to match an arbitrary number of them with the following pattern: ^(.*)$(?:\n\1)+