I'm trying to compare two very large csv files and compare them by a free text field in both. I've tried using awk, e.g.
awk -F, 'FNR==NR{a[$2]++;next} a[$2]' table1.csv table2.csv > duplicates.csv
but the output csv file isn't properly formatted, probably because the free text field contains commas. I'd like to save the entire duplicate row in table1 in the duplicate table. Thanks for your help.