[root@small-master ~]# kubectl get po -A -o wide |grep Running |awk '{print $5}'
0
0
0
0
0
1
2
0
1
1
1
2
1
0
1
2
[root@small-master ~]# kubectl get po -A -o wide |grep Running |awk '{print $5}' | awk '{sum+=$1}END{print sum}'
12
某行
[root@small-master ~]# echo 1 5 6 3 1 |awk '{ for(i=1;i<=NF;i++) sum+=$i; print sum}'
16
标签:kubectl,某列,求和,small,master,print,awk,root,数字
From: https://www.cnblogs.com/anslinux/p/16850157.html