[ILUG] Re: perl file processing

Marcus Furlong furlongm at hotmail.com
Thu Oct 9 02:30:01 IST 2008


Francis Daly <francisdaly <at> gmail.com> writes:

> More idle curiosity, which might be interesting -- were the calculated
> averages equivalent?
> 
> > The sed/awk one comes out with the following:
> > real    0m32.733s
> > user    0m10.915s
> > sys     0m11.838s
> >
> > whereas the pure awk one is a lot faster:
> > real    0m18.239s
> > user    0m2.035s
> > sys     0m2.761s
> >
> > Ran a few times just in case, and those times are fairly consistent. Anyway
> > thanks to you both!
> 
> On those numbers, it should take about a minute to find out.
> 
> Replace "," with ";print" each time in the END block of my awk, and
> you should get two sets of output which are easily diff'able.
> 
> For presentation, you might also like to set OFMT="%.3g" before
> printing -- that limits the number of printed significant figures. Or
> use "f" for decimal places, depending on the input range.

I had already changed this to use printf "%f %f %f %f %f %f\n" which seemed to
do what I wanted.

I got a fright there for a while because some sets of averages didn't match up
at all. It turns out there were more characters than [a-zA-Z] for some class
descriptions. Once that was fixed, yes, both sets of figures are identical.

Marcus.





More information about the ILUG mailing list