awk Compare 2 files, print match and difference

前端 未结 2 1688
日久生厌
日久生厌 2020-12-22 12:14

I need to comapre two files f1.txt and f2.txt and obtain matches, and non-matches, for this case I am looking to match first field on both files. And print first the second

2条回答
  •  悲哀的现实
    2020-12-22 12:50

    This should do:

    awk -F";" 'NR==FNR{a[$1]=$2;next}{if (a[$1])print a[$1],$0;else print "Not Found", $0;}' OFS=";" f2.txt f1.txt
    

提交回复
热议问题