Well I don't really understand awk (I only read the first half of "sed and awk") so I might be missing something here but I had to make some changes to get the script to run at all.

For a start with the script as written I got the following error:
Code:
awk: cmd. line:8:                 print "\t" $2 "/" ${bits[$i]};
awk: cmd. line:8:                                    ^ syntax error
so I had to go away and read up on arrays and find that the thing to do was to split the list of masks and bits into an actual array.
Code:
                { line=0;
                split(masks, maskarray);
                split(bits, bitarray);
                for (i=0; i<=31; i++ ) {
                        if($3 == maskarray[i])
                        {
                                break;
                        }
                }
                print "\t" $2 "/" bitarray[i];
                }
On top of all that you declared the masks and bits lists as bash arrays but since awk is interpreting them as strings you can't just say
Code:
awk -v masks="$masks" bits="$bits"
Instead you need to say
Code:
awk -v masks="${masks[*]}" -v bits="${bits[*]}"
That's definitely enough awk for one day.