Remove duplicate lines in LibreOffice / OpenOffice Writer

4

2

I'm working on a text file in Writer which is basically a sorted list of words and phrases. It contains some duplicates I want to remove.

Normally I would use a regular expression in Search & Replace but I can't get that to work in Writer. I've tried things like this:

^(.*)$\1$

That would work for the same term twice on the same line but the usual ways to express line breaks don't work:

^(.*)$\n\1$

Is there a way to fix this regular expression or some other completely different way to remove duplicate lines in Writer?

hippietrail

Posted 2014-07-29T04:47:10.247

Reputation: 3 699

Answers

2

Neither LibreOffice nor OpenOffice supports PCRE.

From https://help.libreoffice.org/6.3/en-GB/text/shared/01/02100001.html:

For a full list of supported metacharacters and syntax, see ICU Regular Expressions documentation

I think the most salient point to your frustration is that you can only match line breaks that have been entered by keying Shift+Enter, not "normal" line breaks.

There seems to be no easy way around this limitation, so someone wrote an extension with more powerful expressions:

– however, I never used it and can't say whether it will help in your situation.

bjanssen

Posted 2014-07-29T04:47:10.247

Reputation: 2 289