[PLUG] Simple question hoping for a simpler answer

David Fleck david.fleck at mchsi.com
Sat Apr 22 13:52:29 UTC 2006


On Fri, 21 Apr 2006, Jeff Moore wrote:
>    Hi all This may seem to be a little simplistic and rudimentary but I 
>    am trying to learn some of the basics. Anyway my question is how 
>    would all of you(without creating a script) add together the values 
>    of multiple lines from a command like: grep -c bin * | cut -d: -f 2 I 
>    was hoping that there was a very core and basic unix or gnu app that 
>    you can pipe the results of that string too in order to get a 
>    complete total of all the lines.  


grep -c bin * | awk -F: '{ total += $2 } END { print total }'


--
David Fleck
david.fleck at mchsi.com




More information about the PLUG mailing list