April 2018
Beginner
284 pages
7h 3m
English
You can use for loops to iterate over values when using AWK like this:
$ awk '{
total = 0
for (var = 1; var < 4; var++)
{
total += $var
}
mean = total / 3
print "Mean value:",mean
}' myfile

We achieved the same result but using the for loop this time.