Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Compare 2 CSV files and create a new CSV file out of comparision

by moritz (Cardinal)
on Jul 02, 2012 at 09:03 UTC ( #979397=note: print w/replies, xml ) Need Help??


in reply to Compare 2 CSV files and create a new CSV file out of comparision

The proper way to do it is to read the first file, and use a hash to store the contents. Use the vm_name column as key and the whole row as a value.

Then read the second file line by line, and look up the vmname in the hash you created earlier, and print the joined columns to the third file.

  • Comment on Re: Compare 2 CSV files and create a new CSV file out of comparision

Replies are listed 'Best First'.
Re^2: Compare 2 CSV files and create a new CSV file out of comparision
by slayedbylucifer (Scribe) on Jul 02, 2012 at 09:23 UTC
    Hi. could you get me a sample code structure. Sorry, I am asking for too much, but I didn't quite understand "Use the vm_name column as key and the whole row as a value." part. Thanks again for your time.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2016-09-29 21:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (560 votes). Check out past polls.