Monday, February 2, 2009

jEdit delete duplicate lines

In jEdit's Search and Replace dialog, select "Regular Expressions",  then Search for:

replace with:

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.