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

If you enjoyed this post, make sure you subscribe to my RSS feed!

1 Response to “AWK, the summer :)”


  1. 1 Tom

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

Leave a Reply