Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

228.Text sort -- How to sort many lines by comparing the second word in each line?

User: editor -- 2008-07-19          << 227  229 >>
Hits: 502
Type: Text sort   
Search all Text sort 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" on windows platform to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog

* set "Replace with pattern" 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

Screenshot 1:  Replace_Window


Similar Examples:
How to sort the text by the number of specific word in each line? (69%)
How to extract the text between first comma and second comma in each line? (63%)
How to add a komma (,) after first and second words in each line? (62%)
How to sort lines of text file by comparing the sum of column1, 2 and 3? (61%)
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%)

Check Demo of Text sort
Keywords:
comp  sort line  second  text sort  sort  means  mean  many  lines  any  sort text lines  text sort open source  sort by word  second line  many word  many text  by line  from to