awk 'BEGIN{sum=0;i=0;while(i<=100){sum+=i;i++};{print sum}}'
awk 'BEGIN{sum=0;for(i=0;i<=100;i++){sum+=i};print sum}'
#awk -F: '/root/{i=1;while(i<=NF){print $i,length($i);i++}}' /etc/passwd
awk 'BEGIN{sum=0;i=1;do {sum+=i;i++}while(i<=100);print sum}'
转载于:https://blog.51cto.com/14114496/2345577