Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

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

User: editor -- 2010-02-04          << 411  413 >>
Hits: 416
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" on windows platform 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

Similar Examples:
How to remove partially duplicated lines in a text file? (66%)
How to remove all lines that contains more than one word? (65%)
How to remove all the lines that do not contain any of words in a list? (64%)
How to remove all lines that contain one or more words in a list? (61%)
How to delete all the lines without ceramics in text file? (61%)
How to remove all blank lines and lines that started with Name: or Addr:? (61%)
How to remove all lines that contain some specific strings in a text file? (58%)
How to remove all lines with duplicate value in column B in CSV file? (58%)

Check Demo of Advanced search and replace
Keywords:
except  tel  duplicated  last word  duplicate lines  duplicate line  duplicat  else  duplicate  content  except last line  remove all line except  remove except  remove last 3 lines  remove lines without text  duplicated words  remove duplicated lines  replace the last word for each line