csvjoin1
Csvjoin documentation
Overview
Merges two or more CSV tables together using a method analogous to SQL JOIN operation. By default it performs an inner join, but full outer, left outer, and right outer are also available via flags. Key columns are specified with the -c flag (either a single column which exists in all tables, or a comma-separated list of columns with one corresponding to each). If the columns flag is not provided then the tables will be merged "sequentially", that is they will be merged in row order with no filtering:
usage: csvjoin [-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] [-c COLUMNS][--outer] [--left] [--right] [-y SNIFF_LIMIT] [-I][FILE [FILE ...]]Execute a SQL-like join to merge CSV files on a specified column or columns.positional arguments:FILE The CSV files to operate on. If only one is specified,it will be copied to STDOUT.optional arguments:-h, --help show this help message and exit-c COLUMNS, --columns COLUMNSThe column name(s) on which to join. Should be eitherone name (or index) or a comma-separated list with onename (or index) per file, in the same order in whichthe files were specified. If not specified, the twofiles will be joined sequentially without matching.--outer Perform a full outer join, rather than the defaultinner join.--left Perform a left outer join, rather than the defaultinner join. If more than two files are provided thiswill be executed as a sequence of left outer joins,starting at the left.--right Perform a right outer join, rather than the defaultinner join. If more than two files are provided thiswill be executed as a sequence of right outer joins,starting at the right.-y SNIFF_LIMIT, --snifflimit SNIFF_LIMITLimit CSV dialect sniffing to the specified number ofbytes. Specify "0" to disable sniffing entirely, or"-1" to sniff the entire file.-I, --no-inference Disable type inference (and --locale, --date-format,--datetime-format, --no-leading-zeroes) when parsingthe input.Note that the join operation requires reading all files into memory. Don't trythis on very large files.
See also: Arguments common to all tools.
Examples
csvjoin -c 1 examples/join_a.csv examples/join_b.csv
Add two empty columns to the right of a CSV:
echo "," | csvjoin examples/dummy.csv -
Add a single column to the right of a CSV:
echo "new-column" | csvjoin examples/dummy.csv -
Releases
4 releases since Debian 11 (Bullseye); the text changed 3 times.
--blanks until Debian 12 (Bookworm);
--columns until Debian 12 (Bookworm);
--date-format until Debian 12 (Bookworm);
--datetime-format until Debian 12 (Bookworm);
--delimiter until Debian 12 (Bookworm);
--encoding until Debian 12 (Bookworm);
--escapechar until Debian 12 (Bookworm);
--help until Debian 12 (Bookworm);
--left until Debian 12 (Bookworm);
--linenumbers until Debian 12 (Bookworm);
--locale until Debian 12 (Bookworm);
--maxfieldsize until Debian 12 (Bookworm);
--no-doublequote until Debian 12 (Bookworm);
--no-header-row until Debian 12 (Bookworm);
--no-inference until Debian 12 (Bookworm);
--outer until Debian 12 (Bookworm);
--quotechar until Debian 12 (Bookworm);
--quoting until Debian 12 (Bookworm);
--right until Debian 12 (Bookworm);
--skip-lines until Debian 12 (Bookworm);
--skipinitialspace until Debian 12 (Bookworm);
--snifflimit until Debian 12 (Bookworm);
--tabs until Debian 12 (Bookworm);
--verbose until Debian 12 (Bookworm);
--version until Debian 12 (Bookworm);
--zero until Debian 12 (Bookworm);
-H until Debian 12 (Bookworm);
-I until Debian 12 (Bookworm);
-K until Debian 12 (Bookworm);
-L until Debian 12 (Bookworm);
-S until Debian 12 (Bookworm);
-V until Debian 12 (Bookworm);
-b until Debian 12 (Bookworm);
-c until Debian 12 (Bookworm);
-d until Debian 12 (Bookworm);
-e until Debian 12 (Bookworm);
-h until Debian 12 (Bookworm);
-l until Debian 12 (Bookworm);
-p until Debian 12 (Bookworm);
-q until Debian 12 (Bookworm);
-t until Debian 12 (Bookworm);
-u until Debian 12 (Bookworm);
-v until Debian 12 (Bookworm);
-y until Debian 12 (Bookworm);
-z until Debian 12 (Bookworm).