Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

543.Advanced search and replace -- How to delete all lines whose first word appeared in previous line?

User: editor -- 2010-06-22          << 542  544 >>
Hits: 3364
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to delete all lines whose first word appeared in previous line? 
In the example below, make the line started with AAA,BBB,CCC only appeared once.
Input Sample:
AAA line1 
BBB line2 
AAA line3 
CCC line4 
BBB line5
Output Sample:
AAA line1 
BBB line2 
CCC line4 
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 unit' to 'Line' 
* in 'replace with pattern', enter: 
 
 
click 'advanced' page: 
* in 'run following at the beginning of replace' enter: 
 
* in 'run following for each matched unit' enter: 
 
3. click 'replace', done! 
4. ctrl-s save to file.

Similar Examples:
How to delete/remove all lines that appearred more than once? (64%)
How to delete rows with same column as previous line? (62%)
How to replace all lines before first blank line? (62%)
How to delete from FILE A all lines that appear in file B? (62%)
How to delete all lines containing specific word in specific column? (61%)
How to delete all lines appear in file B from file A? (61%)
How to delete all lines that contain only a word and a blank? (59%)
How to delete all columns with more than 8 words in text file? (59%)

Check Demo of Advanced search and replace
Keywords:
line started with  previous  aaa  delete all lines  else  first word  values  delete all  clear  at the beginning  delete first word of each line  delete first word in each line  delete lines with word  delete first word  delete beginning line  delete first lines  delete text at beginning  delete first line in text