interger to I P address
Izaac
izaac at setec.org
Wed Aug 27 21:07:40 UTC 2008
On Wed, Aug 27, 2008 at 05:50:44PM +0200, Andree Toonk wrote:
> The Perl way:
> sub ntoa_in_one_line { join(".", unpack("CCCC", pack("N", $_[0]))); }
> print ntoa_in_one_line(1089055123) . "\n";
dec2ip
awk '{ print int($1 / 16777216) "." int($1 % 16777216 / 65536) "." int($1 % 65536 / 256) "." int($1 % 256) }'
ip2dec
awk '{ split($1, a, "."); print a[1]*16777216 + a[2]*65536 + a[3]*256 + a[4] }'
--
. ___ ___ . . ___
. \ / |\ |\ \
. _\_ /__ |-\ |-\ \__
More information about the NANOG
mailing list