Adding up columns of numbers.

Mark Weiser mark at tove.UUCP
Mon Mar 18 14:31:17 AEST 1985


In article <9273 at brl-tgr.ARPA> root%bostonu.csnet at csnet-relay.arpa (BostonU SysMgr) writes:
>
>P.S. One strange omission (to my knowledge) from all the UNIX tools
>is a program, similar in command syntax (groan, but probably needed)
>to 'sort' which adds up columns of numbers:
>
>	sumcol +4.6 foo
>
>Strange, must have been written hundreds of times.
>--------------------
>*End of UNIX-WIZARDS-REPLY-DIGEST-SORT-OF
>
>	-Barry Shein, Boston University

Awk is great for this.  Something like: awk '{sum += $4}\\
END {print sum}'
	-mark
-- 
Spoken: Mark Weiser 	ARPA:	mark at maryland	Phone: +1-301-454-7817
CSNet:	mark at umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark
USPS: Computer Science Dept., University of Maryland, College Park, MD 20742



More information about the Comp.unix.wizards mailing list