Re: [ILUG] shell scripting help required

From: kevin lyda (kevin at domain suberic.net)
Date: Wed 01 Aug 2001 - 10:30:39 IST


On Wed, Aug 01, 2001 at 09:33:17AM +0100, Chris Higgins <chris.higgins> wrote:
> > On Wed, Aug 01, 2001 at 09:13:38AM +0100, hrishy wrote:
> > > i would like to have a count of all not found
> > > by components........
      ^^^^^^^^^^^^^
> grep "not found" file | wc -l

now how do you do that in shell? i can think of this:

    f=the.text.file
    for c in `awk '{print $1}' $f | sort -u`; do
        echo `grep '^'$c $f | grep 'not found' | wc -l` $c not found
    done | sed 's/^ *//' | grep '^0'

but that loops throught the text file {number of unique components} +
1 times.

kevin

-- 
kevin at domain suberic.net          simple four line sigs -
fork()'ed on 37058400      bandwidth friendly; nice to do.
meatspace place: work      some admins clueless.
http://suberic.net/~kevin          --netiquette haiku 2001


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:25 GMT