This archive is retained to ensure existing URLs remain functional. It will not contain any emails sent to this mailing list after July 1, 2024. For all messages, including those sent before and after this date, please visit the new location of the archive at https://mailman.ripe.net/archives/list/[email protected]/
[routing-wg] Looking for a pgm to CIDRize
- Previous message (by thread): [routing-wg] Looking for a pgm to CIDRize
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ronald F. Guilmette
rfg at tristatelogic.com
Wed Dec 31 22:40:17 CET 2014
In message <5.1.1.6.2.20141231211552.053fed38 at efes.iucc.ac.il>, Hank Nussbacher <hank at efes.iucc.ac.il> wrote: >I am looking for a program or website that can take a list of sorted, >overlapping prefixes and can reduce it to the most CIDRized format. I rolled my own some time ago. It's appended below. It takes the input cidrs either on the command line or via stdin, one per line (with no fluff). It's quite trivial as you can see, but requires the Net::CIDR::Lite package (which does all of the real work). ======================================================================== #!/usr/bin/perl -w use strict; use Net::CIDR::Lite; my $cidr = Net::CIDR::Lite->new; sub process_arg { my ($arg) = @_; unless ($cidr->add($arg)) { die "Error during add of $arg\n"; } } if (scalar @ARGV) { foreach my $arg (@ARGV) { process_arg ($arg); } } else { while (my $line = <STDIN>) { chop $line; process_arg ($line); } } foreach my $c ($cidr->list) { print "$c\n"; }
- Previous message (by thread): [routing-wg] Looking for a pgm to CIDRize
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]