I have two files I’m trying to join/merge based on columns 1 and 2.
input1
22 42960000 rs149201999 A AC 100 PASS LDAF=0.0649;RSQ=0.8652;AN=2184;ERATE=0.0046;VT=SNP;AA=.;AVGPOST=0.9799;THETA=0.0149;SNPSOURCE=LOWCOV;AC=134;AF=0.06;ASN_AF=0.04;AMR_AF=0.05;AFR_AF=0.10;EUR_AF=0.06
input2
22 42960000 . A AC . . ;AA=1;AFE=0.989691;ASNE=1;EUN=0.992509;AFW=1;MED=0.991071;LAT=1
And output will be
22 42960000 . A AC . . ;AA=1;AFE=0.989691;ASNE=1;EUN=0.992509;AFW=1;MED=0.991071;LAT=1;LDAF=0.0649;RSQ=0.8652;AN=2184;ERATE=0.0046;VT=SNP;AA=.;AVGPOST=0.9799;THETA=0.0149;SNPSOURCE=LOWCOV;AC=134;AF=0.06;ASN_AF=0.04;AMR_AF=0.05;AFR_AF=0.10;EUR_AF=0.06
note each column is separated by tab.
Here’s one way using
GNU awk:Result: