Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

228.Advanced search and replace -- How to sort many lines by comparing the second word in each line?

User: editor -- 2008-07-19
Hits: 196
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to sort many lines by comparing the second word in each line?
Input Sample:
abc 006 kkk
www 008 ggggg
bbb 003 gg
ddd 005 oooooooo
Output Sample:
bbb 003 gg
ddd 005 oooooooo
abc 006 kkk
www 008 ggggg
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog

* set "Search for pattern" to:

* set "Unit Number Filter" to:


3. Click "Replace", done!

Note: 
sort_by_word($match,2,2) means sort lines by word from 2 to 2
Download Script:  scripts/228.rst.zip

Similar Examples:
How to add a komma (,) after first and second words in each line? (62%)
How to split a text file to different files according to first word in each line? (61%)
How to findout all lines that contain specified words in multiple files? (61%)
How to split a single line into many lines, keep two words for each line? (60%)
How to sort all lines of text by specified keyword? (59%)
How to sort the lines in a text files by the order of line length? (57%)
How to extract all lines that contain words A and B and C? (57%)
How to delete all text after the second comma in each line? (57%)

Check Demo of Advanced search and replace