First of all, I must apologise : I know there\'s a lot of various topics that already answer my question, but as you\'ll see by yourself, AWK isn\'t really a big friend of m
awk '
NR==FNR {A[$1,$3,$6] = $0; next}
($1 SUBSEP $2 SUBSEP $3) in A {print A[$1,$2,$3], $4}
' A.txt B.txt
That requires the whole file A.txt to be stored in memory. If B.txt is significantly smaller
awk '
NR==FNR {B[$1,$2,$3] = $4; next}
($1 SUBSEP $3 SUBSEP $6) in B {print $0, B[$1,$3,$6]}
' B.txt A.txt