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: 3951
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 all lines that contain specific words in a file? (63%)
How to split a file into many files according to first letter of each line? (63%)
How to extract the text between first comma and second comma in each line? (63%)
How to remove lines containing specified words in a text file? (62%)
How to add a komma (,) after first and second words in each line? (62%)
How to delete all lines containing specific word in specific column? (61%)
How to extract all lines that contain words in a list? (61%)

Check Demo of Text sort
Keywords:
sort lines by word  sort lines  comp  sort line  second  text sort  sort  by word  means  mean  sort text by second word in word  sort text lines  text sort open source  sort by word  text sort word sort  sort by word 1  sort word  second line