widensa.blogg.se

Notepad ++ sort by length
Notepad ++ sort by length













notepad ++ sort by length

Reverse all lines first if you want to sort longest to shortest. Note that this will retain the original ordering when sorting from shortest string to longest string. Choose "Number to Insert" and start with 1, increase by 1, and include leading zeros. Then in the Edit menu select Column Editor. But the reason for adding the line numbers, is so we know the natural order, so that when for example, two+ lines are of equal length we can sort those lines according to that natural order)Īssuming your text file only has the data in it, place the text cursor (the vertical line) into the very first position of the file. (Note added by barlop- a note for the reader regarding this step, we will not be sorting according to these line numbers, we're sorting according to the length of the lines.

notepad ++ sort by length

I'll use the following as example data: Lorem The idea in this answer is to add spaces and line numbers so that _092dog will be sorted above _003alligator.

notepad ++ sort by length

_X (pretending the underscores are really spaces) will similarly come alphabetically before _XX. "The Zoo" comes alphabetically before "Their House" because the space is treated as a character and comes before "i". 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. Notepad++ has a built-in TextFX tool that sorts selected lines alphabetically. Updated to maintain original sort order, if that is important. This answer is inspired by a YouTube video.















Notepad ++ sort by length