| User: editor -- 2010-02-27 << 432 434 >> |
| Hits: 516 |
| 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 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 change multiple files, adding filename at the beginning of each file? (63%) How to batch insert the filename into the beginning of the file conent? (62%) How to sort file by the number which first appear in each line? (61%) |
Check Demo of Text sort |
| Keywords: |
| ddd odd scrip script scr beginning of line text sort time operation date remove text at beginning convert date date convert convert date to search replace by script remove new line remove chars each line replace unit script |