User: Chris -- 2012-08-10 << 987 989 >> |
Hits: 4393 |
Type: Text sort |
Search all Text sort examples |
Description: |
How to sort paragraphs base on the second word in each paragraph? How sort the following example text, based on the second word in each paragraph. Each paragraph has multiple lines and it is defined by a distinct word. The first three lines of the file need to be excluded. |
Input Sample: |
Do not move this line #1 Do not move this line #2 Do not move this line #3 Paragraph cad xxxx xxx xxx xxx xx Xxx xx xx xxx xxx Xxx xx xx Paragraph abc xx xxx xxx xxxx xx Xxx xxx xx xxxx xxx Paragraph bac xxx xxxx xxx Xxx Xxx Xxx (Note: because the procedure below use "_" as line delimiter, we require no "_" is appeared in the source file) |
Output Sample: |
Do not move this line #1 Do not move this line #2 Do not move this line #3 Paragraph abc xx xxx xxx xxxx xx Xxx xxx xx xxxx xxx Paragraph bac xxx xxxx xxx Xxx Xxx Xxx Paragraph cad xxxx xxx xxx xxx xx Xxx xx xx xxx xxx Xxx xx xx |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
Proc: A. remove and record the first 3 lines B. change each paragraph to a single line: Paragraph cad .._<line2>_<line3>... Paragraph abc .._<line2>_... ... C. sort lines D. restore multiple lines and restore first 3 lines A: 1. ctrl-o open text file 2. ctrl-h open 'replace' dialog * set 'replace with pattern' to: * in 'advanced' tab, set 'run following for each matched unit' to: 3. click 'replace' B: 4. ctrl-h open 'replace' dialog * set 'replace unit' to "Paragraph" * set 'replace with pattern' to: * in 'settings' tab, set 'Para Start' to "other": 5. click 'replace' C: 6. ctrl-h open 'replace' dialogue and set 'replace with pattern' to: 7. click 'replace' D: 8. ctrl-h open 'replace' dialog * set 'replace with pattern': 9. click replace. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |