I have two files file1.txt, file2.txt. I want to select records which are common to both file1.txt and file2.txtbased on column 2 and column 3 and copy them to out.txt with additional column(column 4 from file2.txt). Sample Input:file1.txtabc 1 a f11 f13 f14 abd 2 b f12 f14 f13  abe 4 d f13 f16 f12 acf 5 s f14 f15 f19file2.txtabc 1 a f21 f23 f24 abd 1 b f21 f24 f23  abe 4 d f24 f26 f22 acf 6 s f23 f25 f29Desired outputout.txt abc 1 a f11 f13 f14 f21 abe 4 d f13 f16 f12 f24I have asked a similar question earlier on how to work with three files and extract similar output based on similar input for better understanding. I'm new to Unix world and been learning on how to do file processing. Based on that I have tried the below piece of code using awk but didn't work. Could someone please check and suggest, what went wrong ?awk 'FILENAME == ARGV[1] {    m[$2,$3] = 0; z[$2,$3] = $6;    next;}{    if (($2,$3) in m && m[$2,$3] == 1) {        print $0   z[$2,$3] >out.txt;    }}' file2.txt file1.txt
Error in file comparison - awk
linux;shell;files;awk
In your example you are creating array m with values 0. You nowhere set it to 1, and you don't need to. You can just set value to entire row, e.g $0.Try this:awk 'FILENAME == ARGV[1] {    m[$2,$3] = $0;    next;}{    if (($2,$3) in m) {        print m[$2,$3]   $4 >out.txt;    }}' file1.txt file2.txt