1CSVSORT(1) csvkit CSVSORT(1)
2
3
4
6 csvsort - csvsort Documentation
7
9 Sort CSV files. Like the Unix “sort” command, but for tabular data:
10
11 usage: csvsort [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
12 [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
13 [-S] [--blanks] [--date-format DATE_FORMAT]
14 [--datetime-format DATETIME_FORMAT] [-H] [-K SKIP_LINES] [-v]
15 [-l] [--zero] [-V] [-n] [-c COLUMNS] [-r] [-y SNIFF_LIMIT] [-I]
16 [FILE]
17
18 Sort CSV files. Like the Unix "sort" command, but for tabular data.
19
20 positional arguments:
21 FILE The CSV file to operate on. If omitted, will accept
22 input as piped data via STDIN.
23
24 optional arguments:
25 -h, --help show this help message and exit
26 -n, --names Display column names and indices from the input CSV
27 and exit.
28 -c COLUMNS, --columns COLUMNS
29 A comma-separated list of column indices, names or
30 ranges to sort by, e.g. "1,id,3-5". Defaults to all
31 columns.
32 -r, --reverse Sort in descending order.
33 -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
34 Limit CSV dialect sniffing to the specified number of
35 bytes. Specify "0" to disable sniffing.
36 -I, --no-inference Disable type inference when parsing the input.
37
38 See also: Arguments common to all tools.
39
40 NOTE:
41 If your file is large, try sort -t, file.csv instead.
42
44 Sort the veteran’s education benefits table by the “TOTAL” column:
45
46 csvsort -c 9 examples/realdata/FY09_EDU_Recipients_by_State.csv
47
48 View the five states with the most individuals claiming veteran’s edu‐
49 cation benefits:
50
51 csvcut -c 1,9 examples/realdata/FY09_EDU_Recipients_by_State.csv | csvsort -r -c 2 | head -n 5
52
54 Christopher Groskopf
55
57 2023, Christopher Groskopf
58
59
60
61
621.1.1 Jul 21, 2023 CSVSORT(1)