Do you really want to learn Awk's esoterica, in 2006? It doesn't do
aggregation well (SUM, MEAN), and "we know Ruby already."


David Kastrup wrote:
> ben / somethingmodern.com writes:
>
> > On the other hand, have you ever wanted to do some quick math on a CSV
> > without waiting to launch Excel or Gnumeric? (Or you're logged in
> > remotely.) Maybe you'd like to print the average timestamp across all
> > lines in a log file? Or you might wish "cut" split columns with a
> > regexp, not just a delimiter?
> >
> > I just GPL'ed a project of mine for doing spreadsheet style
> > calculations on the command line. It's probably easiest to explain with
> > an example. Say you have a sample file called "data.csv", which looks
> > like this:
> >
> >     Year,Change,TOTAL
> >     2001,34.5,100.1
> >     2002,36.6,101.13
> >     2003,-11,90.5
> >     2004,0,95
> >
> > And then you call the Streaming Spreadsheet like so:
> >
> >     $ cat data.csv | sss 'b=sum(b)' 'c=sd(c)' 'c1="full total"'
> >
> > You'll get this on standard out:
> >
> >     Year    Change  full total
> >     2001    34.5    100.1
> >     2002    36.6    101.13
> >     2003    -11     90.5
> >     2004    0       95
> >             60.1
> >                     4.91642400531117
>
> Looks like a case for awk to me...
> 
> -- 
> David Kastrup, Kriemhildstr. 15, 44793 Bochum