How can I find if a row exists in a file and add a column with the filename using awk?
问题 I'm trying to find if a row in a file already exists in another file, and, in that case, add a column with the filename. File1: CHROM POS REF ALT chr1 10 T A chr1 12 T G chr1 12 T C File2: CHROM POS REF ALT chr1 12 T C chr1 13 A T I want to check if any row in file2 is in file1. Expected output: CHROM POS REF ALT chr1 10 T A chr1 12 T G chr1 12 T C file2 I've tried with this code: `awk -F"\t" 'FNR==NR { seen[$0];next }($0 in seen) { delete seen[$0] }; END{ for (x in seen);$(NF+1)="file";print