From: Conor Daly (conor.daly at domain met.ie)
Date: Thu 30 Aug 2001 - 15:13:58 IST
On Thu, Aug 30, 2001 at 02:31:20PM +0100 or thereabouts, JustinMacCarthy wrote:
> I have a file with a word per line. I have a directory containing both
> files and directories with also contain files etc .
>
> I need to get a list of words that do not appear in the files in the
> directory .
>
> grep -r -i 'word' code gives me the recursive search if the directory for a
> given word and a list of the lines its in. So I'm looking to do something
> like
>
> foreach word
> if not grep -r -i word code
> print word
> else
> continue
>
> What would the best to do this in bash / perl
foreach word
count=`grep -r -i word code | wc -l`
if [ $count == '0' ]; then
print word
fi
done
> Thanks - and no its not home work :-)
Yes it is! He's only doing junior cert this year!
Conor
-- Conor Daly Met Eireann, Glasnevin Hill, Dublin 9, Ireland Ph +353 1 8064276 Fax +353 1 8064275 ------------------------------------ 2:12pm up 16 days, 15:17, 11 users, load average: 0.06, 0.04, 0.00
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:54 GMT