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

猜你喜欢

转载自bestscw.iteye.com/blog/2292254