Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

194.Advanced search and replace -- How to exchange the first word and second word which is separated by _ in all lines?

User: editor -- 2008-06-19          << 193  195 >>
Hits: 1984
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to exchange the first word and second word which is separated by _ in all lines?
Input Sample:
a1____b1_c1_d3 
a2____b2_c2 
a3____b3_c3 
a4____b4
Output Sample:
b1____a1_c1_d3 
b2____a2_c2 
b3____a3_c3 
b4____a4
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source file 
2. ctrl-h open 'Replace' dialog 
in 'Replace' page: 
* set 'Replace Unit' to 'Word' 
* set 'Replace Scope' to 'Line' 
* set 'Unit Number filter' to  
* set 'Search for Pattern' to  
* set 'Replace with Pattern' to  
 
select 'Advanced' page: 
* set 'Run following for each matched unit' to: 
 
 
select 'Settings' page: 
* set 'Input delimiter' to other, and enter '_' at right entry. 
3. Click 'Replace', done!
Download Script:  scripts/194.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Screenshot 3:  Replace_Settings_Window


Similar Examples:
How to extract the first 10 and last 10 characters from each line? (57%)
How to swap the first part and second part of many filenames? (55%)
How to transpose(exchange row and column) a comma separated text file? (54%)
How to replace a word with a list of words repeatly in a text file? (53%)
How to add a word "myword" at the end of each line? (52%)
How can I add a word before the last 10 characters of each line? (52%)
How to extract the text between first comma and second comma in each line? (51%)
Can I change the word order of each line and add a comma as separator? (51%)

Check Demo of Advanced search and replace
Keywords:
exchange  previous  separate  next  delimiter  first word  unit number filter  number filter  second  settings  exchange lines  exchange replace  first and second word  search next  if right  to delimiter  search and replace first  by word