AWK, the summer :)

Sorry, I’m addicted to puns. :)
This is a note for me, you and Michele: do you want to get the sum of a set of integers? Try this one-liner:

awk '{TOT += $0} END {print TOT}' your_filename

Use $0 if your_filename has lines with one integer each, of course you can use $another_integer if you want to get the sum from a given column.

Last update: 2008-02-01

One Comment

  1. Tom
    Posted January 16, 2008 at 2:19 pm | Permalink

    Thanks, very helpful. Much better and smarter than any possible script :-)

Post a Comment

Your email is never shared. Required fields are marked *

*
*