java linux 查看请求的访问时间

awk一个空格算一个量

输出每个请求的访问时间
cat /apps/enabling/paas/containers/20882/logs/access.log |grep ‘getDevices’| awk ‘{if ( 6 4>0) print 0, 6-$4}’

$0表示这一行

输出总的访问时间和平均时间
cat /apps/enabling/paas/containers/20882/logs/access.log | awk ‘{ sum += ( 6 4); } END { print “sum = ” sum; print “average = ” sum/NR }’

输出请求时间大于1s的总条数
cat /apps/enabling/paas/containers/20882/logs/access.log |grep ‘getDevices’| awk ‘{if ( 6 4>1000) print 0, 6-$4}’ |wc -l

输出大于4s的请求
cat access.log | awk ‘{if ( 6 4>4000) print $0}’

你可能感兴趣的:(Java,学习笔记)