Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

172.Advanced search and replace -- How to auto remove/delete consecutive duplicate sentences or phrases in a text file?

User: editor -- 2008-06-03          << 171  173 >>
Hits: 5818
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to auto remove consecutive duplicate sentences or phrases in a text file?
Input Sample:
This is a This is a test, This is the second test, This is the second test, There are There are many tests.
Output Sample:
This is a test, This is the second test, There are many tests.
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
It looks like a difficult issue, but "Replace Pioneer" make it easier: 
1. ctrl-o open source file.       
2. ctrl-h open 'Replace' dialog,       
in 'Replace' window,  
* fill in 'Search for Pattern':       
 
* fill in 'Replace with Pattern':   
 
 
click 'Advanced' page: 
* fill in 'Run following for each matched unit': 
 
 
3. click 'Replace', finish.     
 
Notes: "$match=~s/(.{10,30})\1/\1/gs" is a perl commands with regular expression, is to remove consecutive and duplicated phrase with 10 to 30 characters' length. User can adjust the range wider to get an result with more coverage, but the wider the range is, the slower the text will be processed. 
Download Script:  scripts/172.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to remove/delete consecutive duplicate lines in a text file? (82%)
How to remove consecutive duplicate words in multiple files? (68%)
How to batch remove/delete non-fixed text in a text file? (62%)
How to sort and delete duplicate lines of a text file? (62%)
How to delete duplicate lines of a text file? (62%)
How to remove/delete all English characters/letters in a text file? (62%)
How to remove partially duplicated lines in a text file? (61%)
How to batch remove/delete one blank line between each two lines in text file? (61%)

Check Demo of Advanced search and replace
Keywords:
301  perl command  duplicate sentences  cover  remove consecutive duplicate  duplicate sentence  adjust  phrases  commands  sentences  perl remove duplicate phrases  remove duplicate phrases  perl duplicate phrases  perl remove consecutive duplicate  perl remove duplicate sentences  consecutive phrases  auto remove sentences  duplicate phrases text