utility
sort
Sort lines; locale affects ordering. -n compares numeric keys; -t and -k specify fields.
Formal Syntax & Structure
bash syntaxbash
sort [-n] [-t SEP] [-k KEY] [FILE ...]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| KEY | string | Start and end key positions. |
| SEP | character | Field separator. |
Return Value
exit status
Exit status 0 on success; nonzero indicates failure or a command-specific condition. See description and example.
Working Example
Example Snippetbash
printf '%s\n' 'job:10' 'task:2' 'note:1' | LC_ALL=C sort -t ':' -k2,2n