Paritian

Work & Productivity

Sort Text Lines

Puts a list of lines in alphabetical order, reverse order, or from shortest to longest.

Results

Sorted lines apple banana cherry date elderberry
Lines after 5

What this tool does

Sorting a list is one of those jobs that a spreadsheet does well and everything else does badly. Pasting a column into a word processor to alphabetise it usually means fighting the autocorrect; doing it in the shell means remembering which flag does what. Three orders cover almost every real case: A to Z for a list someone will read, Z to A for a ranking, and shortest first when you are looking for the odd entry that is far longer than the rest.

Formula

sorts the lines alphabetically, in reverse, or by length

Variables

SymbolMeaningUnit
textYour text
modeOrder
OUTSorted lines
LALines after

Worked example

  • Your textcherry apple date banana elderberry
  • Ordersort
  • Sorted linesapple banana cherry date elderberry
  • Lines after5

Limitations

  • The calculation runs entirely in your browser. The values you type are never sent to a server.
  • The calculation runs at full precision and only the display is rounded. If you copy an intermediate value and retype it, small differences can appear.

Frequently asked questions

Where do capitals and accents end up?

The sort is by character code, not by dictionary rules, so every capital letter comes before every lower-case one and accented letters come after the unaccented alphabet. It is entirely predictable and identical everywhere, which is what you want for code, identifiers and data, but it is not how a Portuguese or French dictionary orders words. For a human-facing list, put everything in the same case first.