I have a tab delim file
NC_044998.1 4015 0 TT 2 GG 0 TT 0 TT 0 TT
NC_044998.1 4015 0 TT 0 TT 0 TT 2 GG 0 TT
NC_044998.1 4016 0 TT 0 TT 0 TT 0 TT 0 TT
NC_044998.1 4016 0 TT 0 TT 0 TT 0 TT 0 TT
NC_044998.1 4017 2 CC 2 CC 2 CC 2 CC 2 CC
I wanna add "fixed" to the lines where alternate cols $4,$6,$8,$10,$12 are the same, else add "var".
So that the output is
NC_044998.1 4015 0 TT 2 GG 0 TT 0 TT 0 TT var
NC_044998.1 4015 0 TT 0 TT 0 TT 2 GG 0 TT var
NC_044998.1 4016 0 TT 0 TT 0 TT 0 TT 0 TT fixed
NC_044998.1 4016 0 TT 0 TT 0 TT 0 TT 0 TT fixed
NC_044998.1 4017 2 CC 2 CC 2 CC 2 CC 2 CC fixed
I'm currently using this modification of an answer to a similar question I had posted.
awk -F '\t' '{for (i=6; i<=24; i+=2) if ($i == $4) print $0,"fixed"; else print $0,"var"}'
But it doesn't it seems to be only looking at the first i in the loop.