Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

433.Text sort -- How to sort the text file by the date at the beginning of each line?

User: editor -- 2010-02-27          << 432  434 >>
Hits: 2303
Type: Text sort   
Search all Text sort examples
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
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/

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 batch insert filename at start/beginning of each lines? (69%)
How to insert a text file into the beginning of multiple text files? (69%)
How to decrease the first 4 digits in the beginning of each line by 1000? (67%)
How to remove space at beginning of the line? (64%)
How to split a text file according to first word in each line? (64%)

Check Demo of Text sort
ddd  odd  yyyy  formattime  script  scrip  scr  beginning of line  text sort  operation  add new line at beginning  convert date text  convert date to search  replace convert date  remove text at beginning  convert date  date convert  remove chars each line