sort
Sort text lines from files or stdin deterministically. Supports numeric, reverse, and unique sorting. Returns sorted lines as JSON for downstream processing.
Instructions
Sort text lines deterministically from files or stdin. Read-only, no side effects. Use --numeric for numerical sort, --reverse for descending order, --unique to remove duplicates, and --seed for deterministic tie-breaking. Returns JSON with sorted lines by default; use --raw for plain output. Use to order data for downstream processing. Not for deduplication of non-sorted data — pipe to 'uniq' for adjacent dedup. Not for randomizing — use 'shuf'. See also 'uniq', 'shuf'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoding | No | Text encoding. | utf-8 |
| ignore_case | No | Compare case-insensitively. | |
| max_lines | No | Maximum JSON lines to emit. | |
| numeric | No | Sort by the first numeric token. | |
| paths | No | Files to sort, or '-' for stdin. Defaults to stdin. | |
| raw | No | Write plain transformed text to stdout. | |
| reverse | No | Reverse the sort order. | |
| unique | No | Emit only the first of equal sorted lines. |