Hello,
I am trying to use vlookup (Excel function) using awk but there is some problem
--file1--
ABC123
101F
X1 A $P=Z
X2 A $P=X
X3 B $P=F
X4 C $P=G
MNK180
END
--file2--
X1 A_t $P=Z
X2 A_t $P=X
X3 B_u $P=F
X4 C_o $P=G
Using below,
awk 'NR==FNR {m[$1]=$1; next} {$1=m[$1]; print}' file1 file2
I got the output
--output--
X1 A_t $P=Z
X2 A_t $P=X
X3 B_u $P=F
X4 C_o $P=G
But, the output I want is
--output--
ABC123
101F
X1 A_t $P=Z
X2 A_t $P=X
X3 B_u $P=F
X4 C_o $P=G
MNK180
END
Is there anyway to get the result lilke above?
Please help me.