2016-01-21 23:02:55 +00:00
|
|
|
# csvcut
|
|
|
|
|
2016-01-28 20:11:53 +00:00
|
|
|
> Filter and truncate CSV files. Like Unix's `cut` command, but for tabular data.
|
2016-01-21 23:02:55 +00:00
|
|
|
> Included in csvkit.
|
2019-06-09 00:05:31 +01:00
|
|
|
> More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvcut.html>.
|
2016-01-21 23:02:55 +00:00
|
|
|
|
|
|
|
- Print indices and names of all columns:
|
|
|
|
|
|
|
|
`csvcut -n {{data.csv}}`
|
|
|
|
|
|
|
|
- Extract the first and third columns:
|
|
|
|
|
|
|
|
`csvcut -c {{1,3}} {{data.csv}}`
|
|
|
|
|
2016-01-28 20:11:53 +00:00
|
|
|
- Extract all columns **except** the fourth one:
|
2016-01-21 23:02:55 +00:00
|
|
|
|
|
|
|
`csvcut -C {{4}} {{data.csv}}`
|
|
|
|
|
|
|
|
- Extract the columns named "id" and "first name" (in that order):
|
|
|
|
|
|
|
|
`csvcut -c {{id,"first name"}} {{data.csv}}`
|