Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ip address to hexadecimal converter



| 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).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org