Sort CSV files. Like the Unix "sort" command, but for tabular data:
usage: csvsort [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
[-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
[-S] [--blanks] [--null-value NULL_VALUES [NULL_VALUES ...]]
[--date-format DATE_FORMAT] [--datetime-format DATETIME_FORMAT]
[-H] [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [-n] [-c COLUMNS]
[-r] [-i] [-y SNIFF_LIMIT] [-I]
[FILE]
Sort CSV files. Like the Unix "sort" command, but for tabular data.
positional arguments:
FILE The CSV file to operate on. If omitted, will accept
input as piped data via STDIN.
optional arguments:
-h, --help show this help message and exit
-n, --names Display column names and indices from the input CSV
and exit.
-c COLUMNS, --columns COLUMNS
A comma-separated list of column indices, names or
ranges to sort by, e.g. "1,id,3-5". Defaults to all
columns.
-r, --reverse Sort in descending order.
-i, --ignore-case Perform case-independent sorting.
-y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
Limit CSV dialect sniffing to the specified number of
bytes. Specify "0" to disable sniffing.
-I, --no-inference Disable type inference when parsing the input.
See also: Argumentscommontoalltools.
NOTE:
If your file is large, try sort-t,file.csv instead.