21 Sep
2009
21 Sep
'09
7:42 p.m.
Ric Moseley wrote:
Does anyone know of a tool/script that can aggregate subnets feed to it via command line? Meaning if I give it multiple /30s (or any size subnet) it will scrunch them together.
Here is a Perl script to do just that. My normal one reads from STDIN. #!/usr/bin/perl use Net::CIDR::Lite; my $cidr = Net::CIDR::Lite->new (); foreach (@ARGV) { if (/^[0-9a-f\.:]+(\/\d+)?$/) { $cidr->add_any ($_); } } print (join ("\n", $cidr->list ()));