In article <[EMAIL PROTECTED]>,
Seneca  <[EMAIL PROTECTED]> wrote:
>On Fri, Jul 04, 2003 at 01:51:34PM +0200, Joerg Johannes wrote:
>> I have some data files in the following format:
>> 
>> 1    2       3       4
>> 5    6       7       8
>> 9    10      11      12
>> 13   14      15      16
>> ...
>> 
>> I need to sum up the second column, so the result is 32 (in this case).
>> Any ideas?
>
>awk '{ sum += $2 ; print sum }' foo | tail -1

Isn't that

        awk '{ sum += $2; } END { print sum }' foo

? Awk rocks ;)

Mike.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to