Page 1 of 1

How to delete multiple occurrences of identical paragraphs?

Posted: 2015-02-05 04:50:02
by Þorvarður
Does anyone have a macro that deletes multiple occurrences of identical paragraphs?

From the following list (or paragraphs) I would like to be able to delete "Old Japanese literature" with a macro:
Modern Japanese literature
Japanese literature
Old Japanese literature
Old Japanese literature
Old Japanese literature
Old Japanese literature
Old Japanese literature
English literature
so that the list will look like this:
Modern Japanese literature
Japanese literature
Old Japanese literature
English literature

Re: How to delete multiple occurrences of identical paragrap

Posted: 2015-02-05 05:00:19
by phspaelti
Don't need a macro. Find/Replace will do:

Code: Select all

Find and Replace '^(.+\n)\1+', '\1', 'Ea'

Re: How to delete multiple occurrences of identical paragrap

Posted: 2015-02-06 02:02:55
by Þorvarður
Excellent. Thank you, Philip. :-)

Re: How to delete multiple occurrences of identical paragrap

Posted: 2015-03-05 18:46:20
by adryan
G’day, Þorvarður et al

Just for the record, note that Philip’s solution only works when the replicated paragraphs are contiguous. But one can easily ensure this by first using one of the Sort Paragraphs commands in the Edit menu.

Cheers,
Adrian