awk Compare 2 files, print match and difference

前端 未结 2 1680
日久生厌
日久生厌 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:48

    This was very useful . I have changed a bit to get data between 2 files and only have 1 column in each file .

    awk 'BEGIN { OFS=FS=";" } FNR==NR { array[$1]=$1; next } { print ($1 in array ? array[$1] : "Not Found"), $0 }' file1 file2
    

提交回复
热议问题