I'm trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1. If not found, print Column1 of File1 anyways.
$ File1
Harvard Basketball
Yale Baseball
Princeton Football
Stanford Tennis
$ File2
Rutgers 10 people
Stanford 20 people
Yale 32 people
Tufts 43 people
Harvard 51 people
Desired Output:
Harvard 51 people
Yale 32 people
Princeton
Stanford 20 people
I tried the following code:
awk 'NR==FNR{A[$1]=$2;next} A[$1]{print}' file1 file2
However this doesn't give me Princeton
when column2 is empty, it's omitted entirely. Any help?