SUMMARY vi math problem

From: E. Richard Glazier <erglazier_at_hotmail.com>
Date: Wed, 29 May 2002 18:54:46 +0000

Thanks so much to everyone (and I think everyone resonded!). This was very
educational to me. I need to become more fluent in awk.

Most evryone had an awk solution that went something like this:

>awk '{sum+=+1} END {print sum}' filename


A way to sum each line as you add them, with the total as the additional
last line:

>awk {'print sum += $1'} filename


Here was a pretty slick example of using awk that way"

>ls -l | awk '{sum+=5} END {print sum}'

This totals the file sizes in that directory.


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Received on Wed May 29 2002 - 18:55:00 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT