Re: [ILUG] shell scripting help required

From: kevin lyda (kevin at domain suberic.net)
Date: Wed 01 Aug 2001 - 09:28:52 IST


On Wed, Aug 01, 2001 at 09:13:38AM +0100, hrishy wrote:
> Helloi have a text file with the following feilds
>
> components not found/ident desc
> ---------------------------------------------
> label | not found
> report | not found
> label |not found
> i would like to have a count of all not found
> by components........

uh. by any chance can i get part of your grade and/or salary?

perl -ne 'if (/not found/) {s/^[\w]* |.*/\1/;$s{$1}++} END {foreach $s (sort(keys(%s))) {print "$s{$s} $s not found.\n"}}'

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:24 GMT