操作日志格式
[2017-05-04 09:59:59],Snapshot_Info,tw13c363,xy.push.live.fanxing.com,live,fx_ios_361353991,1493863190.jpg,10646,5946d391863043059cf9c2073dd3e092
#!/bin/bash
domain="xy.push.live.fanxing.com"
base_dir=/data1/log/worker.snapshot/php-fpm/
for file in `find ${base_dir} -type f -name "snapshot.trace.log.2017*"`
do
grep $domain $file|awk -F, '{printf "%.1f\n",$8/1024}'|awk '{sum+=$1}END {print sum/1024/1024}' >>/tmp/fanxing_trace.log
done
awk '{sum+=$1}END{printf "Sum=%dG\n",sum}' </tmp/fanxing_trace.log