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: 815
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 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 sentences that contain specified words? (67%)
How to convert a text file to specified format? (64%)
How to sort all lines of ip addresses in a text file? (64%)
How to findout all lines that contain specified words in multiple files? (64%)
How to sort all the lines of a text file by order the multiple columns? (64%)
How to convert each line of a text file to the new format? (64%)

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