David Byrne wrote:
> Hello,
> 
> I'm trying to map two files INPUT1 to INPUT2.  I
> believe that I've made a syntax error somewhere
> because I'm not retrieving any ouput; yet I know that
> there are IDs in INPUT2 (via $id2) that exist in
> INPUT1 (via $id_1b).
> 
> Also, is there a general, more efficient, way to map
> files that contain similar identifier strings?
        Depending on the size, you can use a hash from one file as a key and then read 
the other file and report using the key if exists, etc to do your print out.  Do it 
all the time when looking for dups.  If any doubt on case of data, then either lc or 
uc the keys to make sure there is a hit.

Wags ;)
> 
> Thank you for any advice,
> David
> 
> foreach $line2 (<INPUT2>) {
>     ($id2,$remainder) = split(/\t/,$line2,2);
>     foreach $line1 (<INPUT1>) {
>       ($id_1a,$id_1b) = split (/\t/,$line1,2);
>       chomp($id_1b);
>       if ($id2 eq $id_1b) {
>           print OUTPUT "$id2\t$id_1a\t$remainder";
>       } else {
>           next;
>       }
>     }
> }
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com



**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  • mapping files David Byrne
    • Wagner, David --- Senior Programmer Analyst --- WGO

Reply via email to