I need to read in two large files (more than 125 MB). Each file contains records that have similar data. I need to find the records that are in both of them, and then if the record fields do not match, I need to overwrite the records in the file with two fields contained in the records from the file.
For example, the first file has the following fields:
ID, ACCT, Bal, Int, Rate
The second file has the following fields:
TYPE, ID, ACCT, Bal, Int, Rate.
So, if the entry in file 1 has the same ACCT number as the entry in file 2, then Bal, Int and Rate in file 2 should be overwritten with the value Bal, Int and Rate from file 1.
Some entries will not be in every file. The output file I need to create is all two records from the file, and if the record is not in the file, then it will be written to the file as is, but then the records that need to be changed will be included.
I tried many different options, but most of them are not efficient enough to work with large files. What is the right direction to solve this problem? Thanks in advance for any help.
source
share