1CSVSTACK(1)                         csvkit                         CSVSTACK(1)
2
3
4

NAME

6       csvstack - csvstack Documentation
7

DESCRIPTION

9       Stack up the rows from multiple CSV files, optionally adding a grouping
10       value to each row:
11
12          usage: csvstack [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b]
13                          [-p ESCAPECHAR] [-z FIELD_SIZE_LIMIT] [-e ENCODING] [-S] [-H]
14                          [-K SKIP_LINES] [-v] [-l] [--zero] [-V] [-g GROUPS]
15                          [-n GROUP_NAME] [--filenames]
16                          FILE [FILE ...]
17
18          Stack up the rows from multiple CSV files, optionally adding a grouping value.
19          Files are assumed to have the same columns in the same order.
20
21          positional arguments:
22            FILE                  The CSV file(s) to operate on. If omitted, will accept
23                                  input as piped data via STDIN.
24
25          optional arguments:
26            -h, --help            show this help message and exit
27            -g GROUPS, --groups GROUPS
28                                  A comma-separated list of values to add as "grouping
29                                  factors", one for each CSV being stacked. These are
30                                  added to the output as a new column. You may specify a
31                                  name for the new column using the -n flag.
32            -n GROUP_NAME, --group-name GROUP_NAME
33                                  A name for the grouping column, e.g. "year". Only used
34                                  when also specifying -g.
35            --filenames           Use the filename of each input file as its grouping
36                                  value. When specified, -g will be ignored.
37
38       See also: Arguments common to all tools.
39

EXAMPLES

41       Joining a set of homogeneous files for different years:
42
43          csvstack -g 2009,2010 examples/realdata/FY09_EDU_Recipients_by_State.csv examples/realdata/Datagov_FY10_EDU_recp_by_State.csv
44
45       Joining files with the same columns but in different orders,  in  Bash,
46       assuming the header row does not contain newlines:
47
48          csvstack file1.csv <(csvcut -c `head -1 file1.csv` file2.csv)
49
50       Add a single column to the left of a CSV:
51
52          csvstack -n NEWCOL -g "" examples/dummy.csv
53

AUTHOR

55       Christopher Groskopf
56
58       2022, Christopher Groskopf
59
60
61
62
631.0.7                            Jul 22, 2022                      CSVSTACK(1)
Impressum