#!/bin/sh # 功能:从ip列表中找到具体某个ip的所有访问日志并生成对应的文件 # # mkdir handle > com.ip.txt function handle(){ #echo "egrep "$1" 0602.log > handle/$n.txt" egrep "$1" 0602.log > handle/$1.txt time=`wc -l handle/$n.txt |awk ‘{print $1}‘` mv handle/$1.txt handle/$1__${time}.txt #sed -i "/$1/d" 0602.log echo $1 >> com.ip.txt sleep 0.02 } m=0 for n in `cat diff.ip ` do m=`expr $m + 1` a=`expr $m % 100` if [ $a -eq 0 ] then sleep 20 fi sleep 0.5 handle $n & done
本文出自 “奋斗吧” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1831608
原文地址:http://lvnian.blog.51cto.com/7155281/1831608