1CSVGREP(1)                          csvkit                          CSVGREP(1)
2
3
4

NAME

6       csvgrep - csvgrep Documentation
7

DESCRIPTION

9       Filter  tabular data to only those rows where certain columns contain a
10       given value or match a regular expression:
11
12          usage: csvgrep [-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] [-n] [-c COLUMNS]
15                         [-m PATTERN] [-r REGEX] [-f MATCHFILE] [-i]
16                         [FILE]
17
18          Search CSV files. Like the Unix "grep" 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 be searched, e.g. "1,id,3-5".
31            -m PATTERN, --match PATTERN
32                                  A string to search for.
33            -r REGEX, --regex REGEX
34                                  A regular expression to match.
35            -f MATCHFILE, --file MATCHFILE
36                                  A path to a file. For each row, if any line in the
37                                  file (stripped of line separators) is an exact match
38                                  of the cell value, the row matches.
39            -i, --invert-match    Select non-matching rows, instead of matching rows.
40            -a  --any-match       Select rows in which any column matches, instead of
41                                  all columns.
42
43       See also: Arguments common to all tools.
44
45       NOTE: Even though ‘-m’, ‘-r’, and ‘-f’ are listed as  “optional”  argu‐
46       ments, you must specify one of them.
47

EXAMPLES

49       Search for the row relating to Illinois:
50
51          csvgrep -c 1 -m ILLINOIS examples/realdata/FY09_EDU_Recipients_by_State.csv
52
53       Search for rows relating to states with names beginning with the letter
54       “I”:
55
56          csvgrep -c 1 -r "^I" examples/realdata/FY09_EDU_Recipients_by_State.csv
57
58       Search for rows that do not contain an empty state cell:
59
60          csvgrep -c 1 -r "^$" -i examples/realdata/FY09_EDU_Recipients_by_State.csv
61
62       Perform a case-insensitive search:
63
64          csvgrep -c 1 -r "(?i)illinois" examples/realdata/FY09_EDU_Recipients_by_State.csv
65

AUTHOR

67       Christopher Groskopf
68
70       2022, Christopher Groskopf
71
72
73
74
751.0.7                            Jul 22, 2022                       CSVGREP(1)
Impressum