stevenrh has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; open(FIRST,"first.txt") || die "$!"; @first = <FIRST>; close FIRST; open(LAST,"last.txt") || die "$!"; @last = <LAST>; close LAST; foreach $i (@first){ if ($i =~ m/@last) }else{ print "$_"; }
steven
Update:
no, this isn't homework :), a colleague and I are trying to match our userbase with the ones we've downloaded from our spam filter provider. we're trying to match/compare/contrast our username list with theirs (then we can batch upload our unfiltered and angry users' names). the file itself is under 1MB (about 40,000 lines). Diff doesn't work because they don't line up exactly, and grep -v -f etc.. choked on us as well. Perl seemed like my last straw.
UP-Update:
The code below satisfies my requirements for what I have to do. THANKS all!!!
--cheers
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: matching the contents of two (2) files
by dragonchild (Archbishop) on Mar 10, 2005 at 19:18 UTC | |
by Roy Johnson (Monsignor) on Mar 10, 2005 at 21:07 UTC | |
by dragonchild (Archbishop) on Mar 11, 2005 at 02:15 UTC | |
Re: matching the contents of two (2) files
by Roy Johnson (Monsignor) on Mar 10, 2005 at 20:59 UTC | |
Re: matching the contents of two (2) files
by bibo (Pilgrim) on Mar 10, 2005 at 19:21 UTC |