Showing revision 1

LoopOnFields

Difference between revision 1 and revision 1

Summary: a recipe

The two revisions are the same.

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
  }
}