兩個文件,我需要根據三列的值,加入他們的行列,如果沒有匹配的打印NA,不匹配列。加入基於我有以下兩個文件三列
cat f1
AAA 0 node4 Activated Unreachable down
AAA 1 node3 Activated Pingable cool
cat f2
AAA 0 node3 XYZ Active
目前我正在使用不正確的輸出:
awk 'NR==FNR{a[$1]=$1;b[$2]=$2;c[$3]=$3;next} $1 in a && $2 in b && $3 in c{print $0}' f1 f2
AAA 0 node3 XYZ Active
所需的輸出:
AAA 0 node4 Activated Unreachable down NA
AAA 1 node3 Activated Pingable cool Active