Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

587.Advanced search and replace -- How to find out all lines that appeared specified number of times?

User: editor -- 2010-08-12          << 586  588 >>
Hits: 394
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to find out all lines that appeared specified number of times?
I have a text file that has many duplicated lines, how to keep all lines that has appearred 3 times, and remove other lines?
Input Sample:
lineA
lineB
lineC
lineA
lineA
lineB
lineB
Output Sample:
lineA
lineB
lineA
lineA
lineB
lineB
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. ctrl-h open replace window
* set 'replace with pattern' to:

* click 'advanced' page, set 'run following for each matched unit' to:

3. click 'replace', done!

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to findout all lines that contain specified words in multiple files? (73%)
How to sort all lines of text by specified keyword? (63%)
How to delete all lines appear in file B from file A? (62%)
How to count the number of english words that has specified number of chars? (62%)
How to remove all the lines that with odd line number for multiple files? (62%)
How to list out all the lines which has having specified keyword.  (62%)
How to delete from FILE A all lines that appear in file B? (61%)
How to remove all the lines appeared in file B,C,D from file A? (60%)

Check Demo of Advanced search and replace
Keywords:
duplicated  times  toc  duplicat  duplicate  dupl  keep  find  values  time  replace text with specified times  remove duplicated lines  remove specified  replace times  find and replace text with a  advanced find and replace find  keep number  remove all text following