1CSVJOIN(1) csvkit CSVJOIN(1)
2
3
4
6 csvjoin - csvjoin Documentation
7
9 Merges two or more CSV tables together using a method analogous to SQL
10 JOIN operation. By default it performs an inner join, but full outer,
11 left outer, and right outer are also available via flags. Key columns
12 are specified with the -c flag (either a single column which exists in
13 all tables, or a comma-separated list of columns with one corresponding
14 to each). If the columns flag is not provided then the tables will be
15 merged “sequentially”, that is they will be merged in row order with no
16 filtering:
17
18 usage: csvjoin [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
19 [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-L LOCALE]
20 [-S] [--blanks] [--date-format DATE_FORMAT]
21 [--datetime-format DATETIME_FORMAT] [-H] [-K SKIP_LINES] [-v]
22 [-l] [--zero] [-V] [-c COLUMNS] [--outer] [--left] [--right]
23 [-y SNIFF_LIMIT] [-I]
24 [FILE [FILE ...]]
25
26 Execute a SQL-like join to merge CSV files on a specified column or columns.
27
28 positional arguments:
29 FILE The CSV files to operate on. If only one is specified,
30 it will be copied to STDOUT.
31
32 optional arguments:
33 -h, --help show this help message and exit
34 -c COLUMNS, --columns COLUMNS
35 The column name(s) on which to join. Should be either
36 one name (or index) or a comma-separated list with one
37 name (or index) per file, in the same order in which
38 the files were specified. If not specified, the two
39 files will be joined sequentially without matching.
40 --outer Perform a full outer join, rather than the default
41 inner join.
42 --left Perform a left outer join, rather than the default
43 inner join. If more than two files are provided this
44 will be executed as a sequence of left outer joins,
45 starting at the left.
46 --right Perform a right outer join, rather than the default
47 inner join. If more than two files are provided this
48 will be executed as a sequence of right outer joins,
49 starting at the right.
50 -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
51 Limit CSV dialect sniffing to the specified number of
52 bytes. Specify "0" to disable sniffing.
53 -I, --no-inference Disable type inference when parsing CSV input.
54
55 Note that the join operation requires reading all files into memory. Don't try
56 this on very large files.
57
58 See also: Arguments common to all tools.
59
61 csvjoin -c 1 examples/join_a.csv examples/join_b.csv
62
63 Add two empty columns to the right of a CSV:
64
65 echo "," | csvjoin examples/dummy.csv -
66
67 Add a single column to the right of a CSV:
68
69 echo "new-column" | csvjoin examples/dummy.csv -
70
72 Christopher Groskopf
73
75 2023, Christopher Groskopf
76
77
78
79
801.1.1 Jul 21, 2023 CSVJOIN(1)