- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2015-06-08 13:53 编辑
回复 7# 关阴月飞
combine your idea together with ip2n, n2ip
$ echo 111.0.255.250-111.1.0.5 | awk -F'-' 'function ip2n(ip, n,c){split(ip,a,".");for(c=1;c<=4;c++)n=n*256+a[c];return n}function n2ip(n, ip,c){ip=n%256;for(c=3;c>0;c--){n=int(n/256);ip=(n%256)"."ip}return ip}{s=ip2n($1);e=ip2n($2);while(s<=e)print n2ip(s++)}'
111.0.255.250
111.0.255.251
111.0.255.252
111.0.255.253
111.0.255.254
111.0.255.255
111.1.0.0
111.1.0.1
111.1.0.2
111.1.0.3
111.1.0.4
111.1.0.5 |
|