Replace Pioneer Home   All Examples   Free Download

 New request --free

412.Advanced search and replace -- How to remove all duplicated lines without considering the last word?

User: editor -- 2010-02-04
Hits: 28
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to remove all duplicated lines without considering the last word?
I have a text file will many lines has duplicated content, except the number at the end of each line is different. How to remove all duplicated lines without considering the last word in each line?
Input Sample:
Advanced search and replace 001
Advanced search and replace 002
Binary replace 003
Batch file rename 004
Binary replace 005
Output Sample:
Advanced search and replace 001
Binary replace 003
Batch file rename 004
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,1,-2) means all words of line except the last one(-1).
Download Script:
scripts/412.rst.zip
Check Demo of Advanced search and replace