addcol - # [Was: Re: What's wrong with this Bourne shell script?]
Frank P. Bresz
fpb at ittc.wec.com
Fri Aug 17 06:19:19 AEST 1990
In article <416 at necssd.NEC.COM> harrison at necssd.NEC.COM (Mark Harrison) writes:
>Here is a simple one in awk. Replace $4 with your column number.
> awk '{ tot += $4} END{print tot}'
> ^^
>If you put this into a shell script called addcol, you can say
> awk '{ tot += $'$1'} END{print tot}'
>and invoke it by
> addcol 4
>Example: How many bytes in my files?
> ls -l c* | awk '{ tot += $4} END{print tot}'
> ls -l c* | addcol 4
>Hope this helps!
It is EXACTLY what I was looking for. Thank you very much for
weeding through and figuring out what I really wanted.!!
--
+--------------------+
|fbresz at ittc.wec.com | My opinions are my own, I'm not paid
|uunet!ittc!fbresz | enough to make an official statement
|(412)733-6749 | +-----------------------------------+
|Fax: (412)733-6444 | | THIS SPACE FOR SALE!!! |
+--------------------+ +-----------------------------------+
More information about the Comp.unix.questions
mailing list