csvkitHow to extract a column from a CSV file using csvkit?
csvkit is a suite of command-line tools for converting to and working with CSV, the king of tabular file formats. It can be used to extract a column from a CSV file.
Example code
csvcut -c <column_name> <input_file.csv>
Output example
column_name
value1
value2
value3
The code above extracts the column with the name column_name
from the CSV file input_file.csv
.
Code explanation
csvcut
: the command to extract a column from a CSV file-c
: the flag to specify the column to be extracted<column_name>
: the name of the column to be extracted<input_file.csv>
: the name of the CSV file from which the column is to be extracted
Helpful links
More of Csvkit
- How to fetch unique values with csvkit?
- How to convert a tsv file to csv with csvkit?
- How to remove duplicates with csvkit?
- How to split a csv file with csvkit?
- How to rename a column with csvkit?
- How to skip the first line with csvkit?
- How to merge multiple files with csvkit?
- How to convert a csv file to tab delimited with csvkit?
- How to select specific columns with csvkit?
- How to use csvkit on Windows?
See more codes...