News for hackers. Stuff that matters.
Re:Csvkit - command line utilities for working with csv files by veyron on Wednesday January 18, 2012 @12:35AM (#3478133)
Is there a CSV AWK?

By that i mean, something that could read the header line in a CSV and automatically generate those variables for each line.

Demonstration:

    $ cat test.csv
    Field1,Field2
    1,2
    3,4
    5,6
    $ csvawk '{print Field1+Field2}' test.csv
    3
    7
    11
Re:Csvkit - command line utilities for working with csv files by ralph on Wednesday January 18, 2012 @06:40AM (#3479132)
IIRC Aho, Weinberger, and Kernighan's excellent slim tome _The Awk Programming Language_ implements something similar; awk is used to generate the awk with Field1 replaced by $1, etc.
Re:Csvkit - command line utilities for working with csv files by veyron on Wednesday January 18, 2012 @11:12AM (#3480356)
It's not that simple because you have to properly handle stuff like "blah,blah" which is supposed to be treated as one block (but blindly using awk -F, will give you two separate fields)
Re:Csvkit - command line utilities for working with csv files by ralph on Friday January 20, 2012 @05:24AM (#3489009)
What's not that simple? I didn't say anything was, just citing a reference. Did you mean to reply to the parent?
Re:Csvkit - command line utilities for working with csv files by klochner on Wednesday January 18, 2012 @01:31AM (#3478331)
it would probably be a pretty easy bash script to write