I have two files with few similar column one, two and third column with small variation and few other columns as follows.file 1:AT1  AT22  24  1 ATAGATA ATTATATAT2  AT24  22  0 ATAGATA ATTATATAT3  AT23  263 3 ATAGATA ATTATATAT4  AT28  252 6 ATAGATA ATTATATSimilarly in file 2:AT1  AT22  22  1 ATAGATA ATTATATAT3  AT23  265  1 ATAGATA ATTATATAT4  AT28  253  1 ATAGATA ATTATATThe output should be Union and unique of these files with relaxation of +or -2 of the third column and if first three matches with these criteria, the fourth column has to be added from the both the files and other should be printed as usual which is likeAT1  AT22  24  2 ATAGATA ATTATATAT2  AT24  22  0 ATAGATA ATTATATAT3  AT23  263 4 ATAGATA ATTATATAT4  AT28  252 7 ATAGATA ATTATAT
Union of two files and unique in new file
shell;awk