I have two files with ids and email addresses. File 2 cotains a subset of the records in file 1. The key field is the first field containing the id.
file 1:
123|myadr@abc.com
456|myadr2@abc.com
789|myadr3@abc.com
file 2:
456|adr456@xyz.com
Where the record appears in the second file, I want to replace the email address in the first file with the address in the second file.
For example, output from above two files would be:
123|myadr@abc.com
456|adr456@xyz.com
789|myadr3@abc.com
I know that I can use awk somehow for this but do not know how so any help would be appreciated.