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: 317
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 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 sort all the numbers in each line randomly? (64%)
How to split a text file according to first word in each line? (64%)
How to add a line number at the beginning of each line? (64%)

Check Demo of Text sort
Keywords:
specific  without  fine  define  return  sub  order  text sort  beginning  at the beginning  sort specific text  sort lines of text  order number  replace with specific  specific line  sort text lines  more word  line order