csvcut

Filter and truncate CSV files. Like Unix's cut command, but for tabular data. Included in csvkit. More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvcut.html>.

Install

All systems
curl cmd.cat/csvcut.sh
Debian Debian
apt-get install csvkit
Ubuntu
apt-get install csvkit
image/svg+xml Kali Linux
apt-get install csvkit
Fedora
dnf install python3-csvkit
Windows (WSL2)
sudo apt-get update sudo apt-get install csvkit
OS X
brew install csvkit
Raspbian
apt-get install python3-csvkit

Filter and truncate CSV files. Like Unix's cut command, but for tabular data. Included in csvkit. More information: <https://csvkit.readthedocs.io/en/latest/scripts/csvcut.html>.

  • Print indices and names of all columns:
    csvcut -n data.csv
  • Extract the first and third columns:
    csvcut -c 1,3 data.csv
  • Extract all columns except the fourth one:
    csvcut -C 4 data.csv
  • Extract the columns named "id" and "first name" (in that order):
    csvcut -c id,"first name" data.csv

© tl;dr; authors and contributors