Okay, here's my situation:
I've got two files, file1 and file2. file1 contains data like this:
file2 contains data like this:
I want my output to look like this:
AMOUNT SSN NAME
10.00 234567890 Doe, Jane
1000.00 123456789 Doe, John
100.00 456789012 One, Any
I need to pull the names from file1 and put the corresponding names (with
the correct SSN's) in file2. Problem is, not every entry that is found
in file1 is also in file2. So a sort, join wouldn't work, unless join
knows how to exclude fields that don't match up. I haven't had much
success with join - I can never get it to give me any output.
Here are the issues I'm dealing with:
1.) file1 contains records that are not in file2. Those would have to be
ignored. (as you can see above, line 3 in file1 has an SSN, but no name,
so it will NOT have a corresponding SSN in file2.)
2.) Neither file is sorted, so simply stripping the unnecesary entries
from both files won't match up properly, especially since file one has
My logic at this point is: "Compare the SSNs in file2 to file1. When
they match, pull the name field from file1 and append it to the end of
the field in file2 for the output (to file3)."
My question is, what unix utility/ies would work best for this? I'm
going to put it into a nightly crontab which will automate the tasks.
Any suggestions or hints? Thanks!