tldr/pages/common/csvgrep.md

18 lines
539 B
Markdown
Raw Normal View History

2016-01-21 23:03:29 +00:00
# csvgrep
> Filter CSV rows with string and pattern matching.
> Included in csvkit.
2019-06-09 00:05:31 +01:00
> More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvgrep.html>.
2016-01-21 23:03:29 +00:00
- Find rows that have a certain string in column 1:
`csvgrep -c {{1}} -m {{string_to_match}} {{data.csv}}`
2016-01-22 02:59:40 +00:00
- Find rows in which columns 3 or 4 match a certain regex pattern:
2016-01-21 23:03:29 +00:00
`csvgrep -c {{3,4}} -r {{regex_pattern}} {{data.csv}}`
- Find rows in which the "name" column does NOT include the string "John Doe":
`csvgrep -i -c {{name}} -m {{"John Doe"}} {{data.csv}}`