Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

424.Advanced search and replace -- How to remove partially duplicated lines in a text file?

User: editor -- 2010-02-18
Hits: 145
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to remove partially duplicated lines in a text file?
I have a text file that has a different sequence number at the beginning of each line. But some lines are duplicated except the sequence number. How to remove these partially duplicated lines?
Input Sample:
123 advanced replace
333 search and replace
258 advanced replace
1693 search and replace
4334 replace
Output Sample:
123 advanced replace
333 search and replace
4334 replace
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
1. ctrl-o open source text file
2. select Menu "Replace->Replace by template->Line Replace->Remove all Duplicate lines", change "Run Following for each matched unit" entry to:

3. Click "ok", click "Replace",done.
4. ctrl-s save to file.

Note: words($match,2,-1) means all words of line except the first one.
Download Script:  scripts/424.rst.zip

Similar Examples:
How to delete duplicate lines of a text file? (80%)
How to sort and delete duplicate lines of a text file? (77%)
How to remove/delete all blank lines in a text file? (74%)
How to reverse the order of all the lines in a text file? (70%)
How to duplicate each line 5 times in a text file? (67%)
How to shuffle all the lines in a text file? (67%)
How to remove/delete all English characters in a text file? (67%)
How to remove all letters before "=" in each line of text file? (65%)

Check Demo of Advanced search and replace