Expand Shortended CIDR notation?

A

Antgoodlife

I'm aware there are a few CIDR modules, however, can any of them
expand short CIDR notation? Some of our unix/freebsd boxes print
routes in this annoying shortened format and I'd like to expand them
for various reasons... (I already written scripts that handle the
destination format so I'd like to continue using them once converted
to a more familiar format...

For example :
10/8
Should be re-written as 10.0.0.0 255.0.0.0 (I'd like both the
network and mask written like that)

Likewise
192.168.50/19
needs to be re-written as 192.168.50.0 255.255.224.0

I'm slightly familiar with the PACK and UNPACK but need some
assistance here.. alternatively some CIDR module might be better
suited here. Thanks in advance.

CIDR is great.. but not when I'm trying to use the expanded formats in
other scripts...
 
J

J. Gleixner

Antgoodlife said:
I'm aware there are a few CIDR modules, however, can any of them
expand short CIDR notation?

Why not look at the documentation for the ones you found? It
should be easy to tell.

Some of our unix/freebsd boxes print
routes in this annoying shortened format and I'd like to expand them
for various reasons... (I already written scripts that handle the
destination format so I'd like to continue using them once converted
to a more familiar format...

For example :
10/8
Should be re-written as 10.0.0.0 255.0.0.0 (I'd like both the
network and mask written like that)

Likewise
192.168.50/19
needs to be re-written as 192.168.50.0 255.255.224.0

I'm slightly familiar with the PACK and UNPACK but need some
assistance here.. alternatively some CIDR module might be better
suited here. Thanks in advance.

CIDR is great.. but not when I'm trying to use the expanded formats in
other scripts...

See: Net::Netmask
 
A

Antgoodlife

Why not look at the documentation for the ones you found? It
should be easy to tell.

 >Some of our unix/freebsd boxes print








See: Net::Netmask

Thank you very much... I missed all of the Netmask module formats...
it can in fact do just this and you've correctly answered my
question... (By the way, I seriously prefer answers like this than
example code.. it forces the OP to learn rather then act)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top