TOOL » LINUX » PACKAGE

Sort

Usage

Sort lines of text files.

shell
sort OPTIONS FILE
OptionDescription
-b --ignore-leading-blanksIgnore leading blanks.
-f --ignore-caseFold lower case to upper case characters.
-g --general-numeric-sortCompare according to general numerical value.
-i --ignore-nonprintingConsider only printable characters.
-h --human-numeric-sortCompare human readable numbers (e.g., 2K 1G).
-n --numeric-sortCompare according to string numerical value.
-R --random-sortShuffle, but group identical keys.
-r --reverseReverse the result of comparisons.
-u --uniqueOutput only the first of an equal run.

Example

Find all file extensions in a git repository:

shell
git ls-files | sed -En 's/^.*\.([^.]*)$/\1/p' | sort -u