Linux awk 日常统计操作

小经验:awk 统计top时先sort 然后uniq -c 比较好。

统计耗时Top 10

cat /data/logs/antispam-center/antispam-center.log.info | grep '支付账号策略数据库查询耗时' | awk -F ' ' '{print $3 ":" $12}' | awk -F ':' '{print $3 "毫秒_" $1}' | sort -n -r | head -10

分钟QPS Top10

cat /data/logs/antispam-center/antispam-center.log.info | grep '支付账号策略数据库查询耗时' | awk -F ':' '{print $3}' | uniq -c | sort -n -r | head -10

秒级QPS Top10

cat /data/logs/antispam-center/antispam-center.log.info | grep '支付账号策略数据库查询耗时' | awk -F '.' '{print $1}' | awk -F ' ' '{print $3}' | uniq -c | sort -n -r | head -10

猜你喜欢

转载自blog.csdn.net/weixin_41485592/article/details/86607788
今日推荐