专注各种脚本编程
Baidu
加入收藏夹
本站内容有下面分类知识,欢迎您的到来^_^
shell相关:指令篇 基础篇 脚本欣赏 编程实例 shell问问 shell视频教程 技巧篇 水平测试 E文资料 vi编辑器 高级Bash脚本编程指南
其他:mysql perl c语言 oracle
当前位置:| 主页>shell脚本欣赏>

统计ip登陆次数

百度收藏 QQ搜藏

代码:
#!/bin/sh
I=0
while [ $I -lt 255 ]
do
I=$[ $I+1 ]
Count=0
IP=192.168.0.$I
while read IPA M
do
if [ $IPA = $IP ]
then
Count=$[ $Count+1 ]
fi
done<log.txt
if [ $Count -gt 0 ]
then
echo "$IP $Count"
fi
done

log .txt文本文件的文件格式
192.168.0.1 dfgsdfgsd
......... ......

上一篇:搜索体积较大的文件,自动备份的脚本 下一篇:mpc转mp3的脚本

power by soyo123 2007-2008