From: "E. Richard Glazier" <erglazier@hotmail.com>
Subject: SUMMARY vi math problem
Date: Wed, 29 May 2002 18:54:46 +0000 [thread overview]
Message-ID: <F147iNZwulnVKdplu890000c678@hotmail.com> (raw)
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 worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
reply other threads:[~2002-05-29 18:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox