shell

awk 计算

[root@BJ-DATABASES lastday]# ps -aux| grep nginx|grep -v grep
root 13783 0.0 0.0 56796 1208 ? Ss 11:13 0:00 nginx: master process nginx
deploy 13786 0.0 0.3 61944 6784 ? S 11:13 0:00 nginx: worker process
deploy 13787 0.0 0.3 61944 6784 ? S 11:13 0:00 nginx: worker process
deploy 13788 0.0 0.3 61944 6784 ? S 11:13 0:00 nginx: worker process
deploy 13789 0.0 0.3 61944 6528 ? S 11:13 0:00 nginx: worker process
[root@BJ-DATABASES lastday]# ps -aux| grep nginx|awk '{sum+=$2;num+=$7}'END'{print sum,num}'
132213 0
[root@BJ-DATABASES lastday]# ps -aux| grep nginx|grep -v grep|awk '{all=$5+$6;print all}'
58004
68728
68728
68728
68472

posted @ 2020-02-22 22:05  devops运维  阅读(249)  评论(0编辑  收藏  举报
python