分类:
2008-07-13 23:25:05
#!/bin/sh
# Author: jackylau
USAGE="Usage: $0 /path/to/filename"
if [ $# -ne 1 ];then
echo $USAGE
exit
fi
if [ ! -d /tmp/temp ];then
mkdir /tmp/temp
fi
awk '{print $1}' $1>/tmp/temp/address
cat /tmp/temp/address|sort|uniq -c|sort -nr|head|awk '{print NR"\t",$1"\t",$2}'
rm -rf /tmp/temp
#!/bin/sh
# Author: jackylau
USAGE="Usage: $0 /path/to/filename"
if [ $# -ne 1 ];then
echo $USAGE
exit
fi
if [ ! -d /tmp/temp ];then
mkdir /tmp/temp
fi
awk '{print $1}' $1 >/tmp/temp/address
Count=`cat /tmp/temp/address|sort|uniq|wc -l`
for (( i=0; i<="$Count"; i++ ))
do
for IP in `head -n 1 /tmp/temp/address`
do
echo "$IP `awk '{print $1}' $1|grep -c $IP`" >>/tmp/temp/after_address
echo "wq"|ex -c "g/$IP/d" /tmp/temp/address
done
done
cat /tmp/temp/after_address|sort -n -r +1|head
rm -rf /tmp/temp