Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

792.Text sort -- How to sort the text by the number of specific word in each line?

User: editor -- 2011-05-31          << 791  793 >>
Hits: 1887
Type: Text sort   
Search all Text sort examples
Description:
How to sort the text by the number of specific word like 'YES' in each line?
The lines with more 'YES' will have a high order, the line without 'YES' will have a lowest order.
Input Sample:
1. YES NO YES NO
2. NO NO YES NO
3. YES YES YES YES
4. NO NO NO NO
5. NO YES YES YES
Output Sample:
3. YES YES YES YES
5. NO YES YES YES
1. YES NO YES NO
2. NO NO YES NO
4. NO NO NO NO
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the text file
2. ctrl-h open 'replace' window
* set 'replace with pattern' to:

* click 'advanced' tab, define the sub-routine in 'run following at the beginning of replace' entry:

3. click 'Replace', done.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to count the number of specified part in each line? (77%)
How to sort file by the number which first appear in each line? (71%)
How to sort a text file by the length of text in each line? (67%)
How to sort many lines by comparing the second word in each line? (67%)
How to add some number to the specific column in csv file? (66%)
How to sort the text file by the date at the beginning of each line? (65%)
How to split a text file with specified start and end line and name? (64%)
How to sort all the numbers in each line randomly? (64%)

Check Demo of Text sort
Keywords:
subroutine  specific word  desc  specific  return  define  without  fine  sub  order  sort specific text  sort lines by word  order number  sort lines of text  more word  specific line  replace with specific  sort text lines