How can I rearrange all of the lines in a file from longest to shortest? For e.g.:
elephant zoo penguin
Would be changed to
elephant penguin zoo
Notepad++ has a built-in TextFX tool that sorts selected lines alphabetically. This tool can be hijacked to sort by the length of the lines by placing spaces on the left of each line, and making sure that all the lines are the same length.
Custom Sorting With key= For example with a list of strings, specifying key=len (the built in len() function) sorts the strings by length, from shortest to longest. The sort calls len() for each string to get the list of proxy length values, and then sorts with those proxy values.
Please follow this step,To sorting data. Step 1: First to select Edit menu than select Line operation. Step 2: After select Sort Lines Lexicographically ascending. I hope this information will be useful.
After restarting Notepad++, go to (menu) Plugins -> Column sorting -> Set criterias , define point-of-start and width of your columns and hit the Sort button.
Add the line length as the first field of the line, sort, and remove the line length:
awk '{ print length($0) " " $0; }' $file | sort -r -n | cut -d ' ' -f 2-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With