Sort lines by numeric value.
sort -n scores.txtSort lines of text. Add -n for numeric order or -r for reverse order.
sort [OPTION]... [FILE]...Sort lines by numeric value.
sort -n scores.txtSort colon-separated records by their third field numerically.
sort -t: -k3,3n /etc/passwd| Option / clause | Description |
|---|---|
-n, --numeric-sort | Compare according to string numerical value. |
-r, --reverse | Reverse the result of comparisons. |
-u, --unique | Output only the first of equal lines. |
-k, --key=KEYDEF | Sort by a selected field or character range. |
-t, --field-separator=SEP | Use SEP instead of whitespace between fields. |
-h, --human-numeric-sort | Compare human-readable numbers such as 2K and 1G. |
-f, --ignore-case | Fold lowercase letters to uppercase for comparison. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.