I have two files file 1 and file 2. I want to see first column of file1 and go to that line number in file2.After that I am comparing $2 of file1 with $6 of file2. If matches then print "correct ans".I want to do this using awk.
file1.txt
1,B
3,C
2,A
file2.txt
Html,WeB,title,tech,Laravel,B
Html,WeB,title,tech,Laravel,D
Html,WeB,title,tech,Laravel,C
Output.txt
Question 1 is correct
Question 3 is correct
Question 2 is incorrect
I have tried to do this.
awk -F[","] 'NR==FNR{n=$1;b=$2}
{if( NR==$1 && $6==b){printf "Question n is correct "}
else { printf "Question n is incorrect"}}' myfile rahulque