次の2つのファイルがあります。3つの列の値に基づいてそれらを結合する必要があります。3つの列に基づいて2つのファイルを結合します
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