sort
Linux · Text · available in the simulator
What it does
Sorts lines of text files.
Syntax
sort [opciones] [archivo...]
Options and parameters
-rReverses the result of comparisons.
-nCompares according to string numerical value instead of alphabetically.
sort -n numeros.txt-uOutputs only the first of an equal run; removes duplicates.
-k Nsorts by column N
-kSorts via a key; sorts by the specified field.
sort -k2 datos.txt-tUses the specified character as the field separator.
sort -t: -k3 -n /etc/passwd-hCompares human-readable numbers like 2K or 1G.
-fFolds lower case to upper case characters (ignores case).
-oWrites result to the specified file instead of standard output.
Usage examples
sort archivo.txtsort -r archivo.txtsort -n numeros.txtsort -u archivo.txtsort nombres.txtsort -nr notas.txtsort -k2 datos.txtsort -t: -k3 -n /etc/passwd