- 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,汗。太多小细节了。
这个是0是system的返回值
阅读(956) | 评论(0) | 转发(0) |