一个计算IP的自定义脚本
时间:2010-11-04 来源:expert1
awk '
function iprange(ip) {if(ip~/32$/){split(ip,xiaofu,"/");return xiaofu[1]"-"xiaofu[1]}else {return system("/usr/bin/ipcalc -b "ip"|awk \047/Address/{printf(\042%s-\042,$2)}/Broadcast/{print $2}\047")}
} /[0-9]/{print iprange($0);next}{print}' ===============但是后边多一个0,奇怪,先保留然后再调试。========== 论坛哥们告诉我,去掉print就好了,否则会打印返回状态0,汗。太多小细节了。
function iprange(ip) {if(ip~/32$/){split(ip,xiaofu,"/");return xiaofu[1]"-"xiaofu[1]}else {return system("/usr/bin/ipcalc -b "ip"|awk \047/Address/{printf(\042%s-\042,$2)}/Broadcast/{print $2}\047")}
} /[0-9]/{print iprange($0);next}{print}' ===============但是后边多一个0,奇怪,先保留然后再调试。========== 论坛哥们告诉我,去掉print就好了,否则会打印返回状态0,汗。太多小细节了。
相关阅读 更多 +