`

awk处理访问日志

 
阅读更多

统计http状态码

cat  www.log  | awk '{a[$9]++} END{for(i in a)print i,"\t",a[i]}' > out.dat

 访问IP分布

cat  access.log   | awk '{a[$1]++} END{for(i in a)print i,"\t",a[i]}' > out.dat

 

统计Linux下最常用的20条命令的shell
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n20

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics