Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Aug 2001 20:18:03 -0300 (ART)
From:      Fernando Gleiser <fgleiser@cactus.fi.uba.ar>
To:        BSD Freak <bsd-freak@mbox.com.au>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Adding Number in a File
Message-ID:  <20010803201522.T73395-100000@cactus.fi.uba.ar>
In-Reply-To: <ca5a6dca5556.ca5556ca5a6d@mbox.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 4 Aug 2001, BSD Freak wrote:

> 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 ??

awk '{tot+=$1}; END {print tot}' path-to-your-file


				Fer



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010803201522.T73395-100000>