¿¹Á¦:
$2 > 6{
n=n+1;
pay=pay+$2*$3}
END{
if(n>0)
print n, "employess, total", pay,\
"average", pay/n
else
print "no employees"
}
°á°ú:
no employees
¿¹Á¦:
#input amount rate years # '#' ´Â comment ÀÓ
#output compounded values at the end of each year
{
i=1;
while(i<=$3){
printf("\t%.2f\n",($1*(1+$2)+i));
i=i+1;
}
}
¼öÇà:
awk -f awk.p1 # ÀÔ·ÂÈÀÏÀÌ ¾øÀ¸¹Ç·Î standard input
100 0.6 5
°á°ú:
161.00
162.00
163.00
164.00
165.00
À§¿Í µ¿ÀÏÇÑ ±â´ÉÀÇ for¹®:
{
for(i=1;i<=$3;i=i+1)
printf("\t%.2f\n",($1*(1+$2)+i));
}