Re: tell the difference between url and ip address
From: Michael Heiming (michael+USENET_at_www.heiming.de)
Date: 06/25/05
- Next message: Loki Harfagr: "Re: Replace symbolic link by bash script"
- Previous message: John W. Krahn: "Re: tell the difference between url and ip address"
- In reply to: John W. Krahn: "Re: tell the difference between url and ip address"
- Next in thread: John W. Krahn: "Re: tell the difference between url and ip address"
- Reply: John W. Krahn: "Re: tell the difference between url and ip address"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 25 Jun 2005 10:40:46 +0200
In comp.unix.shell John W. Krahn <someone@example.com>:
> Michael Heiming wrote:
>> In comp.unix.shell Robert Bonomi <bonomi@host122.r-bonomi.com>:
>>
>>>In article <u6auo2-4jm.ln1@rogers.com>,
>>>Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>>>
>>>>On 2005-06-24, juicymixx@mailinator.com wrote:
>>>>
>>>>>is there a nifty command line way (in bash) to tell the difference
>>>>>between an ip address and a url?
[..]
>>>Shall we mention IPv6? <evil grin>
>>
>> Perl seems to be the easiest, despite requiring Validate::Net,
>> dunno if it works with IPv6.
>>
>> perl -MValidate::Net -le'print !Validate::Net->ip("216.239.39.99")&&"in","valid"'
>>
>> Don't have Validate::Net installed right now.
> You don't have to install it, you can use the Socket module which is installed
> with Perl:
> perl -MSocket -le'eval { inet_ntoa inet_aton "216.239.39.99" }; print $@ &&
> "in", "valid"'
Ah, great info! Works fine for IPv4 not for IPv6.
-- Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94) mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/' #bofh excuse 73: Daemons did it
- Next message: Loki Harfagr: "Re: Replace symbolic link by bash script"
- Previous message: John W. Krahn: "Re: tell the difference between url and ip address"
- In reply to: John W. Krahn: "Re: tell the difference between url and ip address"
- Next in thread: John W. Krahn: "Re: tell the difference between url and ip address"
- Reply: John W. Krahn: "Re: tell the difference between url and ip address"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|