过滤A类、B类、C类地址_shell脚本
#!/bin/bash#过滤A类、B类、C类地址
#过滤A类地址 -o 只显示符合的A类地址
read -p "input the file absolute path:" file
egrep -o "(||1|12)\.{1,3}\.{1,3}\.{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >A_ip
#过滤B类地址【128-191】
egrep -o "(12|1|19)\.{1,3}\.{1,3}\.{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >B_ip
#过滤C类地址【192-223】
egrep -o "(19|2|22)\.{1,3}\.{1,3}\.{1,3}\>" $file |sort -n|uniq -c|sort -k 2 -rn >C_ip
页:
[1]