首页 > 代码库 > awk抓取数据

awk抓取数据

感觉awk判断语句像是乱序的,这一周学习awk总结

grep "all_time" log/bn-as.log | head -4000 |
grep -o baidu_id="[a-z|A-Z|0-9_]*"| awk -F ‘=‘ ‘{if($2 != "") print $2 >> "output_lyning" }‘

 

grep "provider=common" log/bn-bs.log | head -40000 | grep "is_hit_cache=0" |
grep -o "all_time=[0-9]*" | awk -F ‘=‘ ‘{sum+=$2; count+=1} END{print sum/count}‘

 

grep  "provider=common" log/bn-bs.log | head -40000 | grep "is_hit_cache=0" | wc -l