I have a file with this format:

```
probeset_id alleleA alleleB 562_201 562_201 562_202 562_202 562_203 562_203 562_204 562_204 562_205 562_205 562_206 562_206 562_207 562_207 562_208 562_208 562_209 562_209 562_258 562_258
AX-76431849 T C T T C T T T T T C C C T T C T T T C C T
AX-76431844 A G A A G A A A A A G G G A A G A A A G G A
AX-76431845 T C T T C T T T T T C C C T T C T T T C C T

```

I want to replace column 4th to 20th by number code! I want to replace each 2 columns by 1 code number acording to alleleA and alleleB column.

**i.e.** if the letter in column 4th and 5th is similar to alleleA(column 2) replace 4th and 5th by 0, if the letter in column 4th is similar to alleleA(column 2) and the letter in column 5th is similar to alleleB (column 3) or if the letter in column 4th is similar to alleleB(column 3) and the letter in column 5th is similar to alleleA (column 2) then replace column 4th and 5th by 1, if the letter in column 4th and 5th is similar to alleleB(column 3) replace 4th and 5th by 2
so the output that I would like to have is this:

```
probeset_id alleleA alleleB 562_201 562_201 562_202 562_202 562_203 562_203 562_204 562_204 562_205 562_205 562_206 562_206 562_207 562_207 562_208 562_208 562_209 562_209 562_258 562_258
    AX-76431849 T C 0 1 0 0 2 1 1 0 1 1
    AX-76431844 A G 0 1 0 0 2 1 1 0 1 1
    AX-76431845 T C 0 1 0 0 2 1 1 0 1 1

```

I have this code:

```
awk 'NR == 1 { print; next } NR>1 {for (i=4;i<=NF;i++) if ( $i == $2) gsub ($i, 1 );for (i=4;i<=NF;i++) if ( $i == $3) gsub ($i, 2 );print}' input_test.txt > output_test.txt

```

but this is only replacing each column according to to Allele A & B. what I'm not able to do is to select 2 columns together, something like this:

```
(i=4;i<=NF;i++) if (($i == $3) && ($i+1 == $2)) gsub ($i & $i+1 , 1)

```

Thanks