Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Comparing strings from different files

by McA (Curate)
on Oct 08, 2013 at 09:50 UTC ( #1057397=note: print w/ replies, xml ) Need Help??


in reply to Comparing strings from different files

You don't need a script. One look showed me: They are different...

Of course just kidding: You have to explain when two files are equal and when they are different. Where are the records, where are the fields? Even the field names seem to be different.

McA


Comment on Re: Comparing strings from different files
Re^2: Comparing strings from different files
by Jalcock501 (Sexton) on Oct 08, 2013 at 10:03 UTC
    Hi McA The records are the same it's just the Record labels that are slightly different:
    FILE1: 99INSSCH|248| 99POLCOM|3||CAP01|66|3301R7435459||||| 99INSFAC2|MSRA01_ +1||||||"LNI10708"| FILE2: E99INSSCH|248| E99POLCOM|3||CAP01|66|3301R7435459||||| E99INSFAC2|MSRA +01_1||||||"LNI10708"|
    Where it begins 99(label) or E99(label) that is a new record.

    I need to compare the records (not the labels) but I'm not sure how.

    Hope this clears things up a wee bit
      1. Open file1 and read it in one record at a time
      2. Each record should be split into the label and the rest
      3. Make the label the hash key and the rest the hash value
      4. Close file1 and open file2 and read it in one record at a time
      5. Each record should be split into the label and the rest
      6. You now have two rows to compare (the current record from file2 and the one stored in the hash keyed on the label from file1), so do that for whatever "compare" means in your task
      7. Close file2

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-11-29 05:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls