# if in awk
$2 > 4 { n = n + 1; pay = pay + $2 * $3 }
END {
if (n > 0)
print n, "employees, total pay is", pay, "average pay is", pay / n
else
print "no employees are paid more than $6/hour"
}
# for in awk
{
for (i = 1; i <= $3; i = i + 1)
printf("\t%.2f\n", $1 * (1 + $2) ^ i)
}
# while in awk
{
i = 1
while (i <= $3) {
printf("\t%.2f\n", $1 * (1 + $2) ^ i)
i = i + 1
}
}
# array in awk
{ line[NR] = $0 }
END {
i = NR
while (i > 0) {
print line[i]
i = i - 1
}
}