for dir in ${dir_list[*]}
do
cd ${log_path}/$dir/$year/$month/$day
for hour_dir in `ls .`
do
#echo $hour_dir
cd $hour_dir
for min_dir in `ls .`
do
#echo $min_dir
cd $min_dir
for log_file in `ls .`
do
flag="false"
#统计每个日志文件
while read line
do
enter_cnt=`echo $line | grep '_inst::deal_request | enter' | wc -l`
appid_cnt=`echo $line | grep 'appid=' | wc -l`
#echo $enter_cnt---$appid_cnt
if [ "$enter_cnt" = "1" ]
then
flag="true"
fi
#出现enter
if [ "$flag" = "true" ]
then
#appid出现
if [ "$appid_cnt" = "1" ]
then
flag='false'
#记录appid次数
appid=`echo $line | sed -n 's/.*,appid=[0−9a−zA−Z]∗,.*/\1/pg'`
#echo $appid
key=${appid}_${year}_${month}_${day}_${hour}_${min}
echo $key
if [ map['$key'] = "" ]
then
map['$key']=1
else
((map['$key']=map["$key"]+1))
fi
fi
fi
done < $log_file
printf "|%10s|%10s|%10s|%10s|%10s|%10s|%10s|\n" "appid" "year" "month" "day" "hour" "min" "count"
for key in ${!map[@]}
do
echo $key | awk -F'_' '{for(i=1;i<=NF;++i){printf "|%10s",$i}}'
printf "|%10s|\n" ${map[$key]}
done
done
done
done
done