I have 2 files which I need to join and get the union of both after removing duplicates. But I need to remove the duplicates based on a 3rd file. If the duplicate record is present in 3rd file then I need to pick the duplicate record from 1st file else I need to pick the record from 2nd file.
Sample
1st file :
account1record from file1
account2record from file1
account3record from file1
2nd file :
account1record from file2
account2record from file2
account4record from file2
3rd file
account1record from file3
Expected result
account1record from file1 ------ since this is present in 3rd file
account2record from file2 ------ since this is not present in 3rd file
account3record from file1
account4record from file2