#!/bin/bash
#过滤A类、B类、C类地址
#过滤A类地址 -o 只显示符合的A类地址[1-126]
read -p "input the file absolute path:" file
egrep -o "([0-9]|[1-9][0-9]|1[01][0-9]|12[0-6])\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >A_ip
#过滤B类地址【128-191】
egrep -o "(12[89]|1[3-8][0-9]|19[01])\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >B_ip
#过滤C类地址【192-223】
egrep -o "(19[2-9]|2[0-1][0-9]|22[0-3])\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >C_ip
过滤A类、B类、C类地址_shell脚本
原创
©著作权归作者所有:来自51CTO博客作者byzmkb的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:匹配url_shell脚本
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
NETWORK笔记3:IP地址分类(A类 B类 C类 D类 E类)
NETWORK笔记3:IP地址分类(A类 B类 C类 D类 E类)
IP地址 子网掩码 私有地址 network -
查缺补漏-A.B.C.类地址
如果您可以帮我指出错误,那该多好。
查缺补漏-A.B.C.类地址