Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

189.Text sort -- How to sort all lines of text by specified keyword?

User: editor -- 2008-06-14          << 188  190 >>
Hits: 4858
Type: Text sort   
Search all Text sort examples
Description:
How to sort all lines of text by specified keyword?
Input Sample:
Sort the following lines by the key word after "id=" 
http://aaa.bbb.com/ccc.php?name=xxx&id=28 
http://aaa.bbb.com/ccc.php?id=326 
http://aaa.bbb.com/ccc.php?user=aaa&id=225 
http://aaa.bbb.com/ccc.php?id=11
Output Sample:
http://aaa.bbb.com/ccc.php?id=11 
http://aaa.bbb.com/ccc.php?name=xxx&id=28 
http://aaa.bbb.com/ccc.php?user=aaa&id=225 
http://aaa.bbb.com/ccc.php?id=326
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the source file containing lines of text 
2. ctrl-h open 'Replace' dialog 
in 'Replace' page: 
* set 'Replace with Pattern' to: 
 
 
click 'Settings' page: 
set "Word delimiter/Input delimter" to (.)other, and enter id= in the entry at right. 
3. click 'Replace', done! 
 
Note:  
1. sort_by_word($match,2,2,'num') means sort all the text by the 2nd word in each line, 'num' means sort by number, not strings. 
2. The word delimiter is defined as 'id=' at the end of step 2.
Download Script:  scripts/189.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Settings_Window


Similar Examples:
How to shuffle all lines of text in specified range? (78%)
How to extract all lines by specified words in group? (72%)
How to sort all the lines of a text file randomly? (72%)
How to list out all the lines which has having specified keyword.  (72%)
How to extract all lines that contain specified words or phrases? (67%)
How to insert lines between sentences with specified order? (67%)
How to rip out all but line 1 and specified text? (67%)
How to extract all sentences that contain specified words? (67%)

Check Demo of Text sort
Keywords:
sort all lines  2nd  keyword  pages  define  fine  sort by number  strings  key  delimiter  sort lines keyword  sort by keyword  text sort by keyword  containing keyword  lines not containing word  sort containing  keyword line  sort lines by word