csvkitHow to remove columns with csvkit?
csvkit is a suite of command-line tools for working with CSV, the most popular being csvcut
. csvcut
can be used to remove columns from a CSV file.
Example code
csvcut -c 1,3,4 input.csv > output.csv
This command will remove the second column from the input file and save the result to output.csv.
Code explanation
csvcut
: the command used to remove columns from a CSV file-c
: the flag used to specify which columns to keep1,3,4
: the columns to keep, in this case columns 1, 3, and 4input.csv
: the input file>
: the redirection operator used to save the output to a fileoutput.csv
: the output file
Helpful links
More of Csvkit
- How to convert a tsv file to csv with csvkit?
- How to convert a csv file to tab delimited with csvkit?
- How to skip the first line with csvkit?
- How to merge multiple files with csvkit?
- How to convert JSON to CSV using csvkit?
- How to convert a json file to csv with csvkit?
- How to fetch unique values with csvkit?
- How to use csvkit on Windows?
- How to extract a column from a CSV file using csvkit?
- How to split a csv file with csvkit?
See more codes...