#!/bin/bash
read -p "which site do you want to Analysis, xxx|xxx:" site
read -p "which site do you want to Analysis, xxx.access.log.x:" log
read -p "which site do you want to Analysis, YisouSpider|Sogou web spider|Baiduspider:" spider
read -p "which code would you want to Analysis,499|500|502|200|301|504:" status_code
if [ $site = xxx ];then
cat /usr/local/nginx/logs/"$log" | awk '{if ($10 == "'$status_code'") {print $0}}' > /var/tmp/tjlog/xxx_$status_code.log
elif [ $site = xxx ];then
cat /usr/local/nginx/logs/"$log" | awk '{if ($10 == "'$status_code'") {print $0}}' > /var/tmp/tjlog/xxx_$status_code.log
else
echo "Nothing"
fi
echo "$site all $status_code number is: `cat /var/tmp/tjlog/"$site"_"$status_code".log | wc -l`"
echo "0 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:00" | grep "$spider" | wc -l`"
echo "1 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:01" | grep "$spider" | wc -l`"
echo "2 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:02" | grep "$spider" | wc -l`"
echo "3 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:03" | grep "$spider" | wc -l`"
echo "4 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:04" | grep "$spider" | wc -l`"
echo "5 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:05" | grep "$spider" | wc -l`"
echo "6 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:06" | grep "$spider" | wc -l`"
echo "7 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:07" | grep "$spider" | wc -l`"
echo "8 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:08" | grep "$spider" | wc -l`"
echo "9 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:09" | grep "$spider" | wc -l`"
echo "10 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:10" | grep "$spider" | wc -l`"
echo "11 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:11" | grep "$spider" | wc -l`"
echo "12 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:12" | grep "$spider" | wc -l`"
echo "13 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:13" | grep "$spider" | wc -l`"
echo "14 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:14" | grep "$spider" | wc -l`"
echo "15 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:15" | grep "$spider" | wc -l`"
echo "16 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:16" | grep "$spider" | wc -l`"
echo "17 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:17" | grep "$spider" | wc -l`"
echo "18 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:18" | grep "$spider" | wc -l`"
echo "19 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:19" | grep "$spider" | wc -l`"
echo "20 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:20" | grep "$spider" | wc -l`"
echo "21 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:21" | grep "$spider" | wc -l`"
echo "22 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:22" | grep "$spider" | wc -l`"
echo "23 o'clock $status_code number : `cat /var/tmp/tjlog/"$site"_"$status_code".log | grep "2015:23" | grep "$spider" | wc -l`"