sort Command Generator
Generate sort commands to order lines of text files
Getting Started with sort
## What is sort?
`sort` writes the sorted lines of a file (or stdin) to standard output. It can sort lexicographically, numerically, by a key field, in reverse, and remove duplicates.
## How to Use
1. **Set Options** (optional): pick numeric, reverse, unique, a sort key, etc. 2. **Specify File**: Enter the file to sort. 3. **Copy & Run**: Copy the generated command into your terminal.
Common Sort Modes
### `-n` Numeric sort Interpret fields as numbers so `2` sorts before `10`.
### `-r` Reverse Reverse the comparison result (descending).
### `-u` Unique Discard all but one of a run of equal lines.
### `-k KEYDEF` Sort by key Define a field range, e.g. `-k 2` (whole 2nd field) or `-k 2,2` (only 2nd field). Combine with options per key, e.g. `-k 2n`.
### `-t SEP` Field separator Use `SEP` as the field delimiter (default: transition from non-blank to blank).
### `-h` Human numeric Sort human-readable sizes like `2K`, `1G`.
### `-V` Version sort Natural sort of version numbers (e.g. `file-1.2.10` after `file-1.2.9`).
▶How do I sort a CSV by the second column numerically?
▶Why are 10 and 2 in the wrong order?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee