Skip to Content
gnux

-k, --key

Sort via a key; KEYDEF gives location and type.

An option of sortx.

Usage

sortx -k KEYDEF [FILE]...
sortx --key=KEYDEF [FILE]...

Details

ShortLongValueDefaultMeaning
-k--keyKEYDEFsort via a key; KEYDEF gives location and type

Examples

Sort a colon-separated file numerically on its third field

sortx -t : -k 3,3n /etc/passwd

Sort on the second column, then by the first in reverse

sortx -k 2,2 -k 1,1r scores.txt

Help in the terminal

gnux help sortx --key

On this page