How can I parse CSV files on the Linux command line? [closed]
csvtool is really good. Available in Debian / Ubuntu (apt-get install csvtool
). Example:
csvtool namedcol Account,Cost input.csv > output.csv
See the CSVTool manual page for usage tips.
As suggested by @Jonathan in a comment, there is a module for python that provides the command line tool csvfilter. It works like cut, but properly handles CSV column quoting:
csvfilter -f 1,3,5 in.csv > out.csv
If you have python (and you should), you can install it simply like this:
pip install csvfilter
More info at https://github.com/codeinthehole/csvfilter/