AWK compare/merge

File1

 
2917,`0722,RDF1+TDEV,90(6),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`0781,RDF1+TDEV,100(5),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
 
 

File2

 
2917,`0722,RDF1+TDEV,90(6),03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`0781,RDF1+TDEV,100(5),03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A2,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A6,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e

Output needed

 
2917,`0722,RDF1+TDEV,90(6),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`0781,RDF1+TDEV,100(5),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A2,2-way,44,,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A6,2-way,44,,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e

Basically we need to this
compare $7 from 1st file to $6 in 2nd
Append the line if $7 ( file1) = $6 (file2) but $2 (file1) != $2 (file2)

Also add a "," to replace a missing column in file2 to make sure the output file has same columns in all lines -- thx

awk 'NR==FNR{$4=$4",";R[$6,$2]=$0; next}{delete R[$7,$2]}1;END{for(l in R) print R[l]}' FS="," OFS="," file2 file1

Thx for quick reply ... one issue ,output also have lines from file2 where $7 from file1 does not match $6 from file2

for example if file2 is

 
2917,`0722,RDF1+TDEV,90(6),03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`0781,RDF1+TDEV,100(5),03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A2,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A6,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03AB,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c99c6e88,BL_db00p01e

i am getting this output

 
2917,`0722,RDF1+TDEV,90(6),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`0781,RDF1+TDEV,100(5),33,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03AB,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c99c6e88,BL_db00p01e
2917,`03A2,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e
2917,`03A6,2-way,44,03E:0_12E:0,10000000c96c4af3_10000000c96c6e88,BL_db00p01e

There should not be a line with 03AB

awk 'NR==FNR{$4=$4",";R[$6,$2]=$0;next}
{H[$7];delete R[$7,$2]}1;
END{for(l in R)if(split(l,h,SUBSEP)&&h[1] in H)print R[l]}' FS="," OFS="," file2 file1

Thanks a lot Chubler ..