Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

66.Advanced search and replace -- Can I change the word order of each line and add a comma as separator?

User: editor -- 2008-05-07          << 65  67 >>
Hits: 2138
Type: Advanced search and replace   
Search all Advanced search and replace examples
Can I change the word order of each line and add a comma as separator?
Input Sample:
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua and Barbuda
AI Anguilla
Output Sample:
Andorra, AD
United Arab Emirates, AE
Afghanistan, AF
Antigua and Barbuda, AG
Anguilla, AI
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
It's not difficult for 'Replace Pioneer': ctrl-o to open source file ctrl-h to open replace dialog, set as follows:   
In 'Replace' page:   
1) Set "Replace Unit" to be "Line"
2) Fill 'Search for pattern' to be: 

3) Fill 'Replace with pattern' to be: 

3. click 'Replace' Button, ok 

Note: .* means any, words($match,2,-1," "," ") means the words from number 2 to last 1 separated by " "
Download Script:  scripts/

Screenshot 1:  Replace_Window

Similar Examples:
How to join two files line by line with comma as separator? (62%)
How to change all numbers in a text file to the comma separated numbers? (60%)
How to change each line of data to the specified format? (53%)
How to align text to the right side in each line by adding spaces at the left? (53%)
How to change all lines to columns in a text? (52%)
How to change delimiter of the csv file from semicolon to comma with quota? (52%)
How to transpose(exchange row and column) a comma separated text file? (51%)
How to change the order of comma delimited sentence fragments randomly? (51%)

Check Demo of Advanced search and replace
separate  order  any word  comma  last  para  las  replace pioneer  replace pionee  eplace pioneer  change word order by comma  add a last words  add words last  last comma  replace the last word for each line  each line last word  add last word  add comma