Date:      Sun, 5 Aug 2001 14:31:35 -0400
From:      Brian T.Schellenberger <bts@babbleon.org>
To:        BSD Freak <bsd-freak@mbox.com.au>, FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Adding Number in a File

On Friday 03 August 2001 18:11, BSD Freak wrote:
> Hi guys,
>
> I have usage logs which output something like the following in a sing
> text file, called say /var/logs/usage.log

umm . . . sorry for the empty message just now.

Anyway . . .

how about . . .

echo '0 0' | cat - /var/logs/usage.log | sed -e 's/$/ + p/' | dc | tail -1



>
> 00000000000105483732
> 00000000000000045532
> 00000000000000038451
> 00000000000000071624
> 00000000000000054925
> 00000000000000025485
> 00000000000000031866
> 00000000000000051580
> 00000000000000055660
> 00000000000000027465
> 00000000000000033564
> 00000000000000060264
> 00000000000000037315
> 00000000000000023527
> 00000000000003900814
> 00000000000000643809
>
> I want to add up all the numbers on each line of this file and output
> the sum to standard output.
>
> Any ideas how to do this ??
>
> Thanks in advance.....
>
> ---------------------------------------------------------------------
> Listen to your emails from any telephone
> http://www.mbox.com.au
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
Brian T. Schellenberger . . . . . . .   bts@wnt.sas.com (work)
Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)

--------------------> Free Dmitry Sklyarov! <-------------------------