|User: editor -- 2010-02-20 << 425 427 >>|
|Type: Text sort|
|Search all Text sort examples|
|How to sort the lines in a text files by the order of length? |
I have a text file that has many lines with different number of characters, how to sort them by the order of the length? The shorter line will be in the front of the longer line.
|Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.|
|Note: for newer version, please check: |
1. Add a number in the front of each line, indicating the length of the line.
(1) ctrl-o open source text file
(2) ctrl-h open replace dialog
* set 'Replace Unit' to Line
* fill following in 'Replace with Pattern':
(3) click 'Replace', the number is added in the front of each line.
2. Sort the lines
(4) ctrl-h open 'Replace' dialog
(5) fill following in 'Replace with pattern' window:
(6) click 'Replace', text is sorted
3. Remove the numbers
(7) ctrl-h open 'Replace' window
* set 'Replace Unit' to 'Line'
* set 'Replace with Pattern' to:
(8) click 'Replace', number removed
(9) ctrl-s save to file.
|Download Script: scripts/426.rst.zip|
Screenshot 1: Replace_Window
Screenshot 2: Replace_Window
Screenshot 3: Replace_Window
|How to sort all the lines of a text file by order the multiple columns? (80%)|
How to sort each line of text by the order of reversed line? (70%)
How to sort all the lines of a text file randomly? (67%)
How to extract 5 unique lines from a text file with 30 lines? (65%)
How to convert each line of a text file to the new format? (65%)
How to sort lines of text file by comparing the sum of column1, 2 and 3? (64%)
How to merge every 3 lines from file A and every 1 line from file B? (63%)
How to split multiple text files by 100 lines? (62%)
Check Demo of Text sort
|shorter short line length length toc number of characters dic different number order text sort sort text in order by line length sort text files by length text lines replace different characters sort lines by length sort file by line length sort the line by length in text file sort line length sort text file by line length|