in reply to How to go about this?
I have a few other files(20090101.csv, 20090102.csv, and 20090102.csv).What's the difference between 20090102.csv and 20090102.csv ? [That is, why is the same file specified twice, as confirmed by your header Number,20090101,20090102 ,20090102?
Showing us the code you wrote is more likely to help you (by possibly fixing the problem) than by simply giving you the answer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to go about this?
by meredib (Acolyte) on Feb 12, 2009 at 22:22 UTC | |
My Problem is that there are some records that are in the master file that are not in the other file and when I check my output those records don't show. So that's one thing I'm looking for and the other works the other way around in that there are some records in the other file that are not in the master file. Pretty much I want every line from both files in the output file. If there is anyone that can look at the code below and modify it to where it will do just that?
| [reply] [d/l] |
by Plankton (Vicar) on Feb 12, 2009 at 22:48 UTC | |
| [reply] |
by graff (Chancellor) on Feb 13, 2009 at 05:47 UTC | |
Maybe you should read your second file into that same hash (assuming that the contents of both files are structured the same way, or at least that it's easy to tell them apart in terms of their contents). When the second file has a key field that matches something in the first file, you'll need to update the hash value for that key, in order to combine the info from the two files into the one record. Apart from that, keys that occur only in the "master" will remain unmodified in the hash, and keys that occur only in the second file will be loaded and kept as-is in the hash. Then just print out all the hash elements to get the complete union of contents from the two files. (But I really like Plankton's idea of using SQLite -- definitely worthwhile. Also, you really should start with use strict; and use warnings; -- it will make you a better programmer, and you'll grow to appreciate it.) | [reply] [d/l] [select] |