vendredi 4 mai 2018

Error with condition if gsub, else if gsub in awk

could you help me to solve this problem please? I have this syntax in awk:

awk -F'\t' -v OFS="\t" '
    { split($12,a,":"); split($11,b,":"); split($10,c,":"); split($5,d,",");
      if (a[1]=="0/3" || a[1]=="3/3") {
         gsub("0/1","0/0"); gsub("1/1","0/0"); gsub("0/2","0/0");
         gsub("2/2","0/0"); gsub("0/3","0/1"); gsub("3/3","1/1");  
         print $1,$2,$3,$4,d[3],$6,$7,$8,$9,$10,$11,$12
      } ; else if (a[1]=="0/2" || a[1]=="2/2") {
         gsub("0/1","0/0"); gsub("1/1","0/0"); gsub("0/3","0/0"); 
         gsub("3/3","0/0"); gsub("0/2","0/1"); gsub("2/2","1/1");  
         print $1,$2,$3,$4,d[2],$6,$7,$8,$9,$10,$11,$12 
      }
    }' input

And If I run this I receive syntax error in else if condition. Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire