Sort
lastmod 2024-06-26created 2020-07-316 edits
sort or merge records (lines) of text and binary files
Options
-
--reverse,-r - Sort in reverse order.
-
--key N,-kN - Index of the Column to sort by
- Mainly used to sort by file name with commands such as sha256sum. (e.g.
sha256sum * | sort -k2)
- Mainly used to sort by file name with commands such as sha256sum. (e.g.
-
--numeric-sort,-n - Sort numerically.
- Sorting without options gives
1, 10, 11, ..., 19, 2, 20, 21, ..., 29, 3, 30, .... (ASCII code order) This changes it to1, 2, 3, ....
-
-V,--version-sort - natural sort of (version) numbers within text
- Similar to
--numeric-sortabove, but also works with input where numbers are mixed into ordinary text