Hi, I am trying to merge information across 2 files. The first file is a "master" file, with all IDS. File 2 contains a subset of IDs of those in File 1.
I would like to match up individuals in File 1 and File 2, and add information in File 2 to that of File 1 if they appear. However, if an individual doesn't appear in File 2, I want to keep the data they have in File 1.
FILE 1
ID INFO1 INFO 2
PERSON1 A 3
PERSON2 B 2
PERSON3 C 11
PERSON4 D 10
PERSON5 E 6
FILE 2
ID INFO3
PERSON1 PPP
PERSON2 NNN
PERSON3 LLL
Desired output
ID INFO1 INFO2 INFO3
PERSON1 A 3 PPP
PERSON2 B 2 NNN
PERSON3 C 11 LLL
PERSON4 D 10 0
PERSON5 E 6 0
If the data for INFO 3 doesn't exist, this should be replaced with a 0 in place of a value. Would anyone have any ideas? Unless I'm missing something obvious a simple join command won't work. An awk solution would be perfect but I'm currently drawing blanks. Any help would be very much appreciated!