Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Comparing strings from different files

by McA (Priest)
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.


  • Comment on Re: Comparing strings from different files

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057397]
[erix]: for the record: I have not downvoted anyone on that subthread that was my fault
[james28909]: there are all kinds of things that had to happen to let life come to be. but at the same time, life may not be the end goal IF there is any kind of end goal lol
[james28909]: well who is the person who gets to decide which behaviour is worthy of a downvote? a person with their own beliefs? xD
[erix]: teleology -- I've never understood why that was thunk up
[erix]: ( and when teleology was brought up, during my biology-study., I couldn't get an answer either )
[1nickt]: FTR I agree with you about "design." Just not sure about the trajectory of evolution. THere are a lot of dead-ends in the evolutionary paths. I suspect homo sapiens is just one of them.
[james28909]: thanks for the vid holli, i do like it. thanks for sharing :)
[holli]: gives me goosebumps every time I watch it

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2017-12-15 14:39 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.