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 |