日誌格式shell
#!/bin/bashide
#shell統計IP個數日誌
#if [[ $2 == "ip" ]];thenblog
grep -E "http://yygame.duowan.com/strife/full/Strife_V0.3.*._*FULL.exe|http://yygame.duowan.com/strife/full/[1-9]*/Strife_V0.3.*ip
._*FULL.exe" $1|awk '{print $1" "$7}'|sort|uniq|awk '{a[$2]++}END{for(i in a) print i,a[i]}' |sort >tmp_ip.txtget
#elseit
#統計下載次數io
grep -E "http://yygame.duowan.com/strife/full/Strife_V0.3.*._*FULL.exe|http://yygame.duowan.com/strife/full/[1-9]*/Strife_V0.3.*._*Fclass
ULL.exe" $1|awk '{a[$7]++}END{for(i in a) print i,a[i]}'|sort >tmp_count.txt
#fi
#awk '{printf "%s %s ",$4,$2;getline <"f2"; printf "%s %s\n",$2,$3} ' f1 >f3
awk '{printf "%s %s ",$1,$2;getline <"tmp_count.txt"; printf "%s\n",$2} ' tmp_ip.txt > ip_count.txt
rm tmp_ip.txt tmp_count.txt