#!/usr/local/bin/perl use strict; open (FILE1,"Largedatafile.txt") || die "Can't open file File1 $!\n"; open (FILE2,"Smalldatafile.txt") || die "Can't open file File2 $!\n"; open (FILE3,"addressfile.txt") || die "Can't open file File3 $!\n"; while(<FILE2>) { my($var1, $var2, $var3,$var4,$var5)=split(/\t/, $_); while(<FILE1>) { my($id1, $id2,$id3)=split(/\t/,$_); while(<FILE3>) { my($citycode, $statecode,$zipcode)=split(/\t/,$_); if (($id3 ne $var3) and ($citycode ne $var5)) { print "$var1\t$id1\t$zipcode\n"; } } } } close (FILE1); close (FILE2); close (FILE3);

input file1 "Largedatafile.txt"

new_id county_name1 county_id1 routing_number city_cod +e1 56897987 Smith 865487 567rt9834 + 5879654 65798686 Johnson 6587654 6578ce789 + r6587t3 24598702 Rock 6548365 6456t6884 + z0rt345


input file2 "Smalldatafile.txt"

Old_id state_code2 fip_code 865487234 5679834 5879654 6587654098 6578789 43658753 6548365tr 6456884 50054345

input file3 "addressfile.txt"

city_code3 state_code3 zip_code3 5879654 5679834 987656575 r658735 6578789 657656315 z0r3454 6456884 554865434 </c <p> out put file will have new_id from file1, old_id from file2, and zip_code3 from file3 only if state_code2 from file2 not equal to state +_code3 from file3 and city_code3 from file 3 not equal to city_code1 +form file1 </p><p> after running the script I do not get the value of "Old_id" and "cit +y_code3" </p> <c> new_id Old_id zip_code3 new_id Old_id 987656575 new_id Old_id 657656315 new_id Old_id 554865434 new_id Old_id 987656575 new_id Old_id 657656315 new_id Old_id 554865434


thanks for all the help

20060712 Janitored by Corion: Added code tags, as per Writeup Formatting Tips and Writeup Formatting Tips


In reply to Re^2: Comparing text files by lynxct
in thread Comparing text files by lynxct

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.