Page 1 of 1

Eliminate all lines with matching data

Posted: Sat Mar 13, 2010 6:07 pm
by gcotterl
My document contains these lines:

AARDVARK
CAT
DOG
DOG
DOG
ELEPHANT
FISH
WOMBAT
WOMBAT
ZYGOTE

Clicking Tools then Sort, ticking the "Delete Duplicate Lines" box and clicking OK results in:

AARDVARK
CAT
DOG
ELEPHANT
FISH
WOMBAT
ZYGOTE

Does TEXTPAD have a way to eliminate all lines with matching data so the result will be:

AARDVARK
CAT
ELEPHANT
FISH
ZYGOTE

Posted: Sat Mar 13, 2010 6:56 pm
by ben_josephs
Not easily. But WildEdit does:
Search for: ^(.*\r?\n)\1+

[X] Regular expression
[ ] Matches end of line characters [i.e., not selected]

Replace with: [nothing]
Edit: corrected option settings

Eliminate all lines with matching data

Posted: Sat Mar 13, 2010 7:16 pm
by gcotterl
Will TEXTPAD 5.3.1 bookmark the lines containing the same data?

Posted: Sat Mar 13, 2010 9:24 pm
by ben_josephs
Do you mean: Is there a way to get TextPad to bookmark every line that is identical to an adjacent line?

Not that I know of. This is a deficiency of TextPad's aged and weak regular expression engine, which is incapable of allowing a back-reference to refer back over a newline.

Eliminate all lines with matching data

Posted: Sat Mar 13, 2010 10:01 pm
by gcotterl
Yes, that's exactly what I mean.