chr:pos1:pos2   Sun     NC      S1      S2      S3      S4      S9      S11     S14     S15     S16     S17     S18     S19     S28     S29     S30     S33     S34     S35     S36     S37     S38     S39Aradu.A01:100145549:100145556   AG      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AA      AAAradu.A01:100408119:100408137   CA      TA      0       0       0       TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      TA      0Aradu.A01:10102206:10102212     TG      TA      TA      TA      TA      0       TG      TA      TA      TA      TG      TG      TG      TG      TG      TA      TG      TG      TA      0       TG      TGAradu.A01:10112010:10112029     GA      GG      GG      GG      GG      GG      GA      GG      GG      GG      GA      0       GA      GA      GA      GG      GA      GA      GG      GA      0       GAAradu.A01:10112029:10112059     AC      GC      GC      GC      GC      GC      AC      GC      GC      GC      AC      0       AC      AC      AC      GC      AC      0       GC      AC      0       ACAradu.A01:101198026:101198058   GT      GC      GC      GC      GT      GC      0       GT      GT      GC      GT      GT      GT      0       GT      GC      GT      GC      GC      GT      0       GTAradu.A01:101198058:101198081   TC      CC      CC      CC      TC      CC      0       TC      TC      CC      TC      TC      TC      0       TC      CC      TC      CC      CC      TC      0       TCAradu.A01:101306922:101306946   AG      AA      AA      AA      AG      0       AA      AG      AG      AA      0       AG      AG      AG      AG      AA      AG      AG      AA      AG      AG      AGIn the given file, I am trying to match the values in all the fields colum 4 onwards with column 2 and 3. If a value of a field (col 4 and onwards) matches col 2 field then mark it as S, if it matches with col 3 then mark it as N and if it is 0 then assign it -1.Following is what I tried:NR>1  {for(i=4;i<=NF;i++)        { if ( $i == $2 ) $i=S ;          if ( $i == $3 ) $i=N ;          if ( $i == 0 ) $i=-1 ;       } ## if ;       ## for loop is done       print ;       }This is resulting in assigning all the fields except the first 3 as -1.
Matching the values in fields and assigning them the identity based on the match
awk;bioinformatics