Entering edit mode
8.9 years ago
kinsioberoi
▴
10
How can I compare two columns of a VCF file (i.e. chromosome number and position) and return the entire row if both the position and chromosome number match in two diffrent VCF files? The following awk command works to compare one column what changes can I make in it to make it compare two columns together.
awk 'FNR==NR{a[$1]=$0;next}{if(b=a[$1]){print b}}' fileA fileB > out
Can you please post an example of the input and desired output? Thanks.
so for example if File A and B are as following the code with match the 1st column (#CHROM) and the 2nd column(POS) and return the output from A which is matching
File A
File B
OUTPUT
Return from which file? FileA or FileB?
May be this vcftools solution will work for you.