OK, I will try and explain what I need to do as best as possible. Basically I have two CSV files, as per the examples below:
File 1:
Column 1, Column 2
abc , 123
def , 234
adf , 567
File 2
Column 1, Column 2
abc , 123
def , 234
adf , 578
I need to write either a shell script or simple command that will do the following:
- Sort both files by column 1
- Row by row, do the following:
- Using column 1 in file 1, search for this value in column 1 in file 2.
- if found, compare the value in column 2 in file 1 against the value in column 2 of file 2
- if it matches, write column 1, column 2 and "Validated" in column 3 to a separate file
- if it does not match, write column 1, column 2 and "Failed" to a separate file
- Using column 1 in file 1, search for this value in column 1 in file 2.
This results in two output files: the first with everything that was found in column 1 and column 2 matches, and a second file containing either column 1 lookups that failed or where column 1 was found, where column 2 did not match, so, essentially, using column 1 as the key to check column 2.