it would be most useful to see your code, as well as some samples of your input and desired output.
As a general rule, when you're looking for records (or parts of records) that are in file 2 and not in file 1, the best method is to read file 1 and to store the data of interest of file 1 in a hash; and then to scan file 2 and keep the records not matching the hash. BTW, a hash will remove the duplicates.
Not knowing anything about your input files (e.g., what is the record separator?), I can't suggest any real code. But the basic idea in pseudo-code is:
Open file 1 and read file 1 record by record, and: for (each record) { get column D from the record; get the interesting part from column D; store the interesting part in a hash: some thing like: $hash{inter +esting part} = 1; } close file 1 open file 2 and read file 2 record by record, and: for (each record) { get column D from the record; get the interesting part from column D; if (exists $hash{interesting part}) { print $hash{interesting part}; } } close file 2;
I (and other monks here) will be able to provide actual code if you provide the necessary information (especially sample input and desires output).
In reply to Re: 2 files
by Laurent_R
in thread 2 files
by Deicide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |