I'd rather not fire up Open Office or try to figure out how to make awk parse a quoted excel-format file, so I wrote 'csql', which reads a csv file into an in-memory sql database, performs a query, and then writes the result also in csv format.
A short example:
Buffy Summers,false,0 Xander Harris,true,2 Willow Rosenberg,true,1
name text attend boolean count integer
$ csql rsvp.csv 'select sum(count) from t where attend="true"' 3 $ csql rsvp.csv 'select name from t where attend="true"' Xander Harris Willow Rosenberg
Files currently attached to this page:
Entry first conceived on 16 October 2011, 15:31 UTC, last modified on 15 January 2012, 3:46 UTC
Website Copyright © 2004-2017 Jeff Epler