sort
Sort records from input or from files.
Synopsis
bash
recs sort [options] [files...]Description
Sort records from input or from files. You may sort on a list of keys, each key sorted lexically (alpha order) or numerically. The sort type may be prefixed with '-' to indicate decreasing order. The sort type may be postfixed with '*' to sort the special value 'ALL' to the end (useful with collate --cube).
Options
| Flag | Description |
|---|---|
--key / -k <keyspec> | Sort key specification. May be comma-separated, may be specified multiple times. Each keyspec is a name or name=sortType. Sort type may be lexical, numeric, nat, lex, n, or l. May be prefixed with '-' for decreasing order. May be postfixed with '*' to sort the special value 'ALL' to the end. |
--reverse / -r | Reverse the sort order. |
Examples
Sort on the id field numerically
bash
recs sort --key id=numericSort on age numerically, then name lexically
bash
recs sort --key age=numeric,nameSort on decreasing size, then name
bash
recs sort --key size=-numeric --key nameSort numerically, with 'ALL' values last
bash
recs sort --key count=numeric*