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) for each file, in the same order that
38 the files were specified. May also be left
39 unspecified, in which case the two files will be
40 joined sequentially without performing any matching.
41 --outer Perform a full outer join, rather than the default
42 inner join.
43 --left Perform a left outer join, rather than the default
44 inner join. If more than two files are provided this
45 will be executed as a sequence of left outer joins,
46 starting at the left.
47 --right Perform a right outer join, rather than the default
48 inner join. If more than two files are provided this
49 will be executed as a sequence of right outer joins,
50 starting at the right.
51 -y SNIFF_LIMIT, --snifflimit SNIFF_LIMIT
52 Limit CSV dialect sniffing to the specified number of
53 bytes. Specify "0" to disable sniffing entirely.
54 -I, --no-inference Disable type inference when parsing CSV input.
55
56 Note that the join operation requires reading all files into memory. Don't try
57 this on very large files.
58
59 See also: ../common_arguments.
60
62 csvjoin -c 1 examples/join_a.csv examples/join_b.csv
63
64 This command says you have two files to outer join, file1.csv and
65 file2.csv. The key column in file1.csv is ColumnKey, the key column in
66 file2.csv is Column Key.
67
68 Add two empty columns to the right of a CSV:
69
70 echo "," | csvjoin examples/dummy.csv -
71
73 Christopher Groskopf
74
76 2020, Christopher Groskopf
77
78
79
80
811.0.4 Jul 29, 2020 CSVJOIN(1)