LoopOnFields

Fields are numbered from 1 to NF, so you can easily use a for loop, and the derefence operator, for instance to print each field matching foo:

for (i=1;i<=NF;i++) 
{
  if ($i ~ /foo/)
  {
    print $i
  }
}