beast wrote:
Good morning,

Hello,

I have 2 files which contains some IDs. Basically I want to search ID
in the file A which is missing on the file B.

This program is ugly, but its work :-)
------------
use strict;

my $target_file = "B.txt";
while(<>) {
   chomp;
   my $res = `grep $_ $target_file`;
   print "$_ is missing\n" if ! $res;
}
------------

I'm trying to found another solutions which more perlish and efficient.
So far im relying that ID should be same digits on the both file,
because "123" will match "1234" :-(

File contents is around 20k - 30k lines, so i must consider the
performance and memory usage also.

A.txt
-----
12345
56789
32134
62134
42134
52134
12234

B.txt
-----
12234
42134
82134
32134

$ cat A.txt
12345
56789
32134
62134
42134
52134
12234
$ cat B.txt
12234
42134
82134
32134
$ grep -f A.txt -wv B.txt
82134



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to