Skip to content

Instantly share code, notes, and snippets.

@kks32
kks32 / compare_columns_file.sh
Last active June 14, 2018 21:47
AWK command to compare two columns of different files and print required columns from both files.
awk -F',' 'NR==FNR{label[$1]=$1;date[$1]=$2;next}; ($2==label[$2]){print $0 "," date[$2]}' <(sort -k1 file2.csv) <(sort -k2 file1.csv) &> file3.csv