Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1319.Advanced search and replace -- How to remove the first occurrance of duplicated words in each line?

User: Dilip -- 2015-10-18          << 1318  1320 >>
Hits: 1220
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I have Tab separated text file 
 
mercedes benz by benz benz 
 
I want to replace the word found in the first column that matches with the  
second column and replace it with nothing for only one time. 
 
Find with Chars (Replace Unit) and Line (Replace Scope) 
^([^\t\n]*)\t([^\t\n]*)\t 
 
Replace with Pattern 
replace($1,"$2",)\t$2\t 
 
But this removes all matches found in the second column but I want only  
replacement with nothing only once.
Input Sample:
mercedes benz by benz benz
Output Sample:
mercedes by benz benz
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'replace unit' to 'Line' 
* set 'replace with pattern' to: 
 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to remove duplicate column in each line? (69%)
How to remove the first 10 characters of each line in text file? (67%)
How to remove consecutive duplicate words in multiple files? (66%)
How to replace an random occurrence of an word with an random line? (64%)
How to count the occurrence of a list of words in a text file? (63%)
How to remove the first pair of parenthesis and enclosed content in each line? (62%)
How to count the occurrance of specific pattern in each line of text file? (62%)
How to remove every other characters on each line of text? (61%)

Check Demo of Advanced search and replace
Keywords:
duplicated words  matches  occurrance  replacement  duplicated  found  second column  mer  separate  first column  remove second line  word replace one time only  remove text first word  remove first column  only one column  remove first word  text replacement  first and second words