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 select specific columns with csvkit?
- How to remove duplicates with csvkit?
- How to install csvkit on a Mac?
- How to remove header with csvkit?
- How to use csvkit on Windows?
- How to fetch unique values with csvkit?
- How to merge columns with csvkit?
- How to convert a json file to csv with csvkit?
- How to change the delimiter in csvkit?
See more codes...