ip address to hexadecimal converter
John Chambers
jc at trillian.mit.edu
Sat Apr 28 23:10:32 EDT 2001
| On Fri, Apr 27, 2001 at 09:59:21AM -0400, Robert Sarao wrote:
| > Does anyone have a software package that they love that converts the
| > ip octet address to hexadecimal. Something simple, we just have to do some
| > conversion and it would be a nice tool...
For you JAPH fans, here's one:
#!/usr/bin/perl
for(@ARGV){printf "%08X\n",((($1<<8)+$2<<8)+$3<<8)+$4 if /(\d+)\.(\d+)\.(\d+)\.(\d+)/}
No error checking to speak of, and it only works for 4-number IP addresses.
I wonder if it can be compressed any more? Probably ...
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list