I need to compare two input files (file1.csv and file2.csv) and store the results and a third file (file3.csv).
The conditions are as follows:
- If entry matches file1 and file2, store it on file3
- If entry is found on file1, store it on file3
It looks like this:
input: file1.csv
"switch10"
"switch33"
"router51"
"switch6"
"router44"
"router12"
"switch2"
input: file2.csv
"router51";"DatacenterA - cab1";"Prod - Tenant12"
"switch33";"DatacenterB - cab14";"Prod - Tenant4"
"switch2";"DatacenterA - cab3";"Dev - Tenant5"
"router44";"DatacenterC - cab2";"Test - Tenant2"
results: file3.csv
"router12"
"router44";"DatacenterC - cab2";"Test - Tenant2"
"router51";"DatacenterA - cab1";"Prod - Tenant12"
"switch2";"DatacenterA - cab3";"Dev - Tenant5"
"switch6"
"switch10"
"switch33";"DatacenterB - cab14";"Prod - Tenant4"
I have tried lots of combinations using 'awk'; however I cannot construct the conditionals.
I was wondering if someone could help me construct the conditional(s) to build this results file3.csv.
Assistance is much appreciated.