Re: [ILUG] shell scripting help required

From: Chris Higgins (chris.higgins at domain horizon.ie)
Date: Wed 01 Aug 2001 - 11:07:30 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:

cat file | grep pattern1 | grep pattern2 | sort | uniq -c

>
> 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

-- 
** Chris Higgins                         e: chris.higgins at horizon.ie **
** Technical Business Development        tel: +353-1-6204916            **
** Horizon Technology Group              fax: +353-1-6204949            **


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