Problem in making a list with awk

Hi bodies,I am doing a list from a .txt file with awk commands but something is wrong.
The .txt file looks like:

32782   28   18
 32783   02   18
 32784   01   18
 32785   29   18
 32786   25   23
 32787   25   18
 32788   00   18
 32789   25   26
 32790   02   23
 32791   29   26
 32792   23   26
 32793   01   23
 32794   28   23
 32795   00   23
 32796   00   26
 32797   28   26
 32798   02   26
 32799   01   26
 32800   21   27
 32801   23   27
 32802   02   27
 32803   00   27
 32804   28   27
 32805   25   27
 32806   29   27
 32809   28   30
 32810   00   30

and the code that I wrote is:

BEGIN{print"//start";}

{X[NR]=$1;Y[NR]=$2;Z[NR]=$3;
for (j=0; j<=31 ; j++)
{   for(i=1; i<=NR ; i++)
	{
	if (X+1==X[i+1])
	{
	if (j==Y)
	{P=Y[i+1];
	stack[j,P]=1
	}
}
}
}

}
END{
for(j=0; j<=31; j++)
	{for (k=0; k<=31; k++)
		{print(j ,"  " k ,"  " stack[j,k])

}
}
}

It should list all the successive numbers (if the X[i]+1==X[i\+1] is met), but it does not work for number less than 10

0   0   
0   1   
0   2   
0   3   
0   4   
0   5   
0   6   
0   7   
0   8   
0   9   
0   10   
0   11   
0   12   
0   13   1
0   14   1
0   15   
0   16   
0   17   
0   18   
0   19   1
0   20   
0   21   1
0   22   
0   23   1
0   24   1
0   25   1
0   26   1
0   27   1
0   28   1

Thanks for your help
:slight_smile:

I don't understand what you are trying to accomplish here. I think it needs a bit more prose. Also, what is the desired output?

sorry for bad explanation , for example the desire output for example can be:

0   0   1
0   1   
0   2   1
0   3   
0   4   
0   5   1
0   6   
0   7   
0   8   
0   9   1
0   10   
0   11   
0   12   
0   13   1
0   14   1
0   15   
0   16   
0   17   
0   18   
0   19   1
0   20   
0   21   1
0   22   
0   23   1
0   24   1
0   25   1
0   26   1
0   27   1
0   28   1

but in the output that I obtained as you can see here

28   26   
28   27   1
28   28   
28   29   1
28   30   1
28   31   
29   0   
29   1   
29   2   
29   3   
29   4   
29   5   
29   6   
29   7   
29   8   
29   9   
29   10   1
29   11   1
29   12   
29   13   
29   14   
29   15   
29   16   1
29   17   

whenever there is a number less than 10 in 2nd column I can't obtain a 1 in 3rd column
hope it make it more clear :slight_smile: