9951 explained code solutions for 126 technologies

csvkitHow to select specific columns with csvkit?

csvkit is a suite of command-line tools for working with CSV, the most popular being csvcut. csvcut allows you to select specific columns from a CSV file.

Example code

csvcut -c 1,3,4 myfile.csv

Output example


Code explanation

  • csvcut: the command to select specific columns from a CSV file
  • -c: the flag to specify the columns to select
  • 1,3,4: the columns to select, in this case columns 1, 3, and 4
  • myfile.csv: the CSV file to select columns from

Helpful links

Edit this code on GitHub