[geeks] Programming question.

alex j avriette avriettea at speakeasy.net
Tue Apr 2 08:52:58 CST 2002


On Monday, April 1, 2002, at 09:00 PM, Brian Hechinger wrote:

> On Mon, Apr 01, 2002 at 09:05:54PM -0500, Big Endian wrote:
>>
>> grep -v ?
>> *ducks*
>
> for blah in `cat fileA;do grep -v $blah fileB;done
> for blah in `cat fileB;do grep -v $blah fileA;done

this is an okay way to do it, and ive done it a bunch of times. but 
beware it can be hideously slow as the file sizes increase. isnt this 
one of those evil O(C^n) algorithms?

i would as well recommend perl and specifically the module file::slurp. 
something like this line:

my @missing = map { grep { $_ } @lista } @listb;

although i havent tested it.

--
alex j avriette, perl hacker
avriettea at speakeasy.net
http://envy.posixnap.net/



More information about the geeks mailing list