From owner-freebsd-questions Sun Aug 5 11:33: 3 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail7.nc.rr.com (unknown [24.93.67.54]) by hub.freebsd.org (Postfix) with ESMTP id C85E137B403 for ; Sun, 5 Aug 2001 11:32:59 -0700 (PDT) (envelope-from bts@babbleon.org) Received: from i8k.babbleon.org ([66.26.250.89]) by mail7.nc.rr.com with Microsoft SMTPSVC(5.5.1877.687.68); Sun, 5 Aug 2001 14:31:38 -0400 Content-Type: text/plain; charset="iso-8859-1" From: Brian T.Schellenberger To: BSD Freak , FreeBSD Questions Subject: Re: Adding Number in a File Date: Sun, 5 Aug 2001 14:31:35 -0400 X-Mailer: KMail [version 1.2] References: In-Reply-To: MIME-Version: 1.0 Message-Id: <01080514313502.00550@i8k.babbleon.org> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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! <------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message