cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:command:sort.html



How to use sort command in Linux

sort Options


       -r, --reverse
              reverse the result of comparisons

       -k, --key=KEYDEF
              sort via a key; KEYDEF gives location and type

       -t, --field-separator=SEP
              use SEP instead of non-blank to blank transition

       -u, --unique
              with -c, check for strict ordering; without -c, output only the first of an equal run

       -n, --numeric-sort
              compare according to string numerical value


Examples

$ sort -k 2 -t ":" test.txt

$ sort -k 2,3 -t ":" test.txt

$ sort -k 2 -t ":" -n test.txt



os/linux/command/sort.html.txt ยท Last modified: 2021/03/15 by admin

Page Tools