This works for me...

#!/usr/bin/perl -w

while (<>){
    print if $_=~/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/;
    }

Regards,
Matt


--- William <[EMAIL PROTECTED]> wrote:
> hi,
> 
> i want to be able to read a text file and extract only the valid
> ip addresses. however, along with valid ip addresses my code is
> grabbing "periods" and invalid ip addresses, e.g., .xxx,
> www.xxx.yyy . how can i correct this?
> 
> =====
> while (<inFILE>) {
>    chomp;
>    if (($L) = ($_) =~ m/\b([0-9.0-9.0-9.0-9]+)\b/ ) {
>       print $L, "\n";
>    }
>    #etc... 
> }
> 
> #etc...
> =====
> 
> 
> tia,
> Bill


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to