I want to remove the rows from File1.csv by comparing a column/field in the File2.csv. If both columns matches then I want that row to be deleted from File1 using shell script\(awk\). Here is an example on what I need.
File1.csv:
RAJAK,ACTIVE,1
VIJAY,ACTIVE,2
TAHA,ACTIVE,3
File2.csv:
VIJAY
TAHA
Output:
RAJAK,ACTIVE,1
Above scenario I need to delete the records if col1 of File1=col2 of File2 and the output should be File1 after removing the duplicate records.
Can you please help me out in preparing a shell script for above.
I tried the given code but it is giving the following error.
Error: grep: can't open |VIJAY
Actually I'm new to this shell/awk scripting. Is there any help using awk script will be very much helpful.
Working with Franklin52's suggestion this is probably all you need:
grep -v -f file2.csv file1.csv >output-file
I note that in your sample, file2 isn't actually a comma separated list. If that is true, then the previous command will be fine. However, if file2 is indeed a comma separated list (as the name and your description implies) then you'll need to take a different approach.