0

file1

CHR  POS  ID  REF  ALT  D1  D2  D3  
3  35863940  rs15689009  T  C,G  NO  NO  YES  
11  85123789  rs78018396  G  A,T  NO  YES  YES  
9  11234300  rs6512203  G  A,C,T   YES  YES  NO  
22  1728499  rs00981837  A  G,T  NO  NO  YES

file2

CHR  POS  ID  REF  ALT  K1  K2    
3  35863940  rs15689009  T  C,G  YES  NO    
9  11234300  rs6512203  G  A,C,T   YES  NO    
11  85123789  rs78018396  G  A,T  YES  YES     

Desired output

CHR  POS  ID  REF  ALT  D1  D2  D3 K1  K2  
3  35863940  rs15689009  T  C,G  NO  NO  YES  YES  NO   
11  85123789  rs78018396  G  A,T  NO  YES  YES  YES  YES  
9  11234300  rs6512203  G  A,C,T   YES  YES  NO  YES  NO  
22  1728499  rs00981837  A  G,T  NO  NO  YES  -  -  -

I tried

paste file1 file2 | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$14,$15}'

but this doesnt consider order of rows in both files

based on matching values in column 1 , 2, 3 in file1 and file2
column 1st to 8th of file1 and 6th & 7th column of file2 should be in output

Jetchisel
  • 7,493
  • 2
  • 19
  • 18
rij
  • 159
  • 7
  • 2
    What is the reason of posting [multiple problems simultaneously](https://stackoverflow.com/q/68728117/548225)? Better to resolve one and then work on another. – anubhava Aug 10 '21 at 14:43
  • 1
    Closing this as a dup as it's mostly just a subset of the problem in the OPs previous question and doesn't attempt to build on the [answer](https://stackoverflow.com/a/68728236/1745001) they got to their previous question that could be easily enhanced to handle the additional requirements in this question. – Ed Morton Aug 10 '21 at 14:47

0 Answers0