Date: Mon, 22 May 2000 12:55:36 +0200 From: "Dan Larsson" <dl@tyfon.net> To: <mj@isy.liu.se> Cc: <questions@FreeBSD.ORG> Subject: RE: calculate sum in sh Message-ID: <NEBBJANJCNNAKCPFKHHFAEHDCEAA.dl@tyfon.net> In-Reply-To: <XFMail.000522124146.mj@isy.liu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
| On 22-May-00 Dan Larsson wrote: | > How to I calculate the sum of all values, the | > values are listed one value per line in a textfile | > using shell commands (no perl available)? | > | Not pure shelling, but you can try this with awk | | File 'crap.txt' is : | | 1 | 2 | 3 | 20 | | then | | lagrange> awk '{sum += $0} END{print "Grand total is "sum}' crap.txt | Grand total is 26 Perfect! Thanks! | Regards ------------ Dan Larsson 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?NEBBJANJCNNAKCPFKHHFAEHDCEAA.dl>