![]() |
![]()
| ![]() |
![]()
NAMEcsvgrep - csvgrep Documentation DESCRIPTIONFilter tabular data to only those rows where certain columns contain a given value or match a regular expression: usage: csvgrep [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b] See also: Arguments common to all tools. NOTE: Even though '-m', '-r', and '-f' are listed as "optional" arguments, you must specify one of them. EXAMPLESSearch for the row relating to Illinois: csvgrep -c 1 -m ILLINOIS examples/realdata/FY09_EDU_Recipients_by_State.csv Search for rows relating to states with names beginning with the letter "I": csvgrep -c 1 -r "^I" examples/realdata/FY09_EDU_Recipients_by_State.csv Search for rows that do not contain an empty state cell: csvgrep -c 1 -r "^$" -i examples/realdata/FY09_EDU_Recipients_by_State.csv Perform a case-insensitive search: csvgrep -c 1 -r "(?i)illinois" examples/realdata/FY09_EDU_Recipients_by_State.csv Remove comment rows: printf "a,b\n1,2\n# a comment\n3,4" | csvgrep --invert-match -c1 -r '^#' Get the indices of the columns that contain matching text (\x1e is the Record Separator (RS) character): csvgrep -m 22 -a -c 1- examples/realdata/FY09_EDU_Recipients_by_State.csv | csvformat -M $'\x1e' | xargs -d $'\x1e' -n1 sh -c 'echo $0 | csvcut -n' | grep 22 NOTE: This last example is not performant.
AUTHORChristopher Groskopf and contributors COPYRIGHT2016, Christopher Groskopf and James McKinney
|