Linux awk for do while while 循环
There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence.
awk 'BEGIN {for (x=1;x<=4;x++) {print x}}'
awk 'BEGIN {x=1; do {print x; x++} while (x<=4)}'
awk 'BEGIN {x=1; while(x<=4) {print x; x++}}'
awk 'BEGIN {x=1; while(1) {print "wfdsb["x"]"; if (x==10) {break} x++;}}'
awk 'BEGIN {x=1; while(1) { if (x==4) {x++;continue;} print "wfdsb["x"]"; if (x>20) {break;} x++;}}'
awk 'BEGIN {arrays[1]="yj";arrays[2]="cyj";arrays[3]="xcyj"; for(x in arrays) {print arrays[x]}}'
awk 'BEGIN {arrays[1]="yj";arrays[2]="cyj";arrays[3]="xcyj"; for(x in arrays) {print arrays[x]} print arrays[2]}'
netstat -an | awk '/^tcp/{++s[$NF] } END {for (a in s) {print a, s[a]}}'