Not sure how much of help this can be, but I find this alot easier....
cat 1.txt | perl -e use Net::CIDR; print join("\n", Net::CIDR::range2cidr(<STDIN>));
1.txt:
192.168.0.1-192.168.0.100
192.168.1.0-192.168.1.50
You can also make it work with netmask, doc has examples:
http://search.cpan.org/~mrsam/Net-CIDR-0.11/CIDR.pm




Reply With Quote
