| User: editor -- 2010-02-27 << 432 434 >> |
| Hits: 578 |
| Type: Text sort |
| Search all Text sort examples |
| Description: |
| How to sort the text file by the date at the beginning of each line? |
| Input Sample: |
| 23/Feb/2009 13:22:20 test line1 25/Feb/2009 19:12:20 test line2 08/Jan/2008 08:08:08 test line3 24/Feb/2009 00:03:19 test line4 |
| Output Sample: |
| 08/Jan/2008 08:08:08 test line3 23/Feb/2009 13:22:20 test line1 24/Feb/2009 00:03:19 test line4 25/Feb/2009 19:12:20 test line2 |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| 1. ctrl-o open source text file 2. make operation on text file: (1) convert the date to format of YYYY-MM-DD-hh:mm:ss and add to the beginning of line: * ctrl-h open 'Replace' dialog * set 'Replace Unit' to chars * set 'Replace Scope' to Line * set 'Search for pattern' to: * set 'Replace with pattern' to: * click 'Replace', there will be a new format of date added to the beginning of each line (2) sort the text * ctrl-h open 'replace' dialog again * set 'Replace with pattern' to: * click 'Replace', text file will be sorted (3) remove the added date * ctrl-h open 'replace' dialog again * set 'replace unit' to chars * set 'replace scope' to Line * set 'search for pattern' to: * click 'Replace', the added date is removed. Note: the attached 433.rst script contain all 3 steps above |
| Download Script: scripts/433.rst.zip |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Window |
Screenshot 3: Replace_Window |
Similar Examples: |
| How to sort a text file by the length of text in each line? (74%) How to insert a word or phrase to the begining of each line? (72%) How to add a line number at the beginning of each line? (71%) How to insert a text file into the beginning of multiple text files? (69%) How to split a text file according to first word in each line? (64%) How to limit a text file to less than 40 chars each line? (64%) How to move a string from the end of the line to the beginning of the line? (63%) How to change multiple files, adding filename at the beginning of each file? (63%) |
Check Demo of Text sort |
| Keywords: |
| ddd odd formattime script scrip scr beginning of line text sort time date convert date date convert convert date to search replace by script remove text at beginning remove new line remove chars each line replace unit script |