Reply to topic  [ 4 posts ] 
How to delete multiple occurrences of identical paragraphs? 
Author Message

Joined: 2012-12-19 05:02:52
Posts: 226
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:

Quote:
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:

Quote:
Modern Japanese literature
Japanese literature
Old Japanese literature
English literature


2015-02-05 04:50:02
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Don't need a macro. Find/Replace will do:
Code:
Find and Replace '^(.+\n)\1+', '\1', 'Ea'


Attachments:
Find identical paras.jpg
Find identical paras.jpg [ 40.4 KiB | Viewed 2742 times ]

_________________
philip
2015-02-05 05:00:19
Profile

Joined: 2012-12-19 05:02:52
Posts: 226
Excellent. Thank you, Philip. :-)


2015-02-06 02:02:55
Profile

Joined: 2014-02-08 12:57:03
Posts: 170
Location: Australia
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

_________________
MacBook Pro (mid-2014)
macOS Sierra 10.12.6
Nisus Writer user since 1996


2015-03-05 18:46:20
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software