bash-3.00# cat > b1.txt
AAA,Apples,123
BBB,Bananas,124
CCC,Carrot,125
bash-3.00# cat > b2.txt
Store1|AAA|123|11
Store2|BBB|124|23
Store3|CCC|125|57
Store4|DDD|126|38
bash-3.00# awk -F"[,|]" 'NR==FNR{a[$1]++;next} !a[$2]' b1.txt b2.txt
Store4|DDD|126|38
When NR==FNR
returns true for first file a[$1]
gets incremented. next
brings back to beginning of the script. But what is !a[$2]
doing here? How does it print without even a print
command?
root
. – jw013 Nov 27 '12 at 17:06