My previous mail has a small problem
this one should fix it

  open FILE, "test.txt" or die "Can't open file!: $!";
   while( <FILE> )
   {

        my @parts = parts(/\s+/);
        foreach (@parts){
            if (/^(\d+\.\d+\.\d+\.\d+)$/){
                print "$1\n";
            }
        }
   }
   close FILE;
________________________________________
Rakhitha Karunarathne
Web Master
www.Ad-Man.tk - Free Unlimited Banner Rotators
________________________________________



----- Original Message ----- 
From: "Durai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 11:54 AM
Subject: Newbie: Perl reg. expression


> Hello All,
>
>  open FILE, "test.txt" or die "Can't open file!: $!";
>   while( <FILE> )
>   {
>      print if /(\d+\.\d+\.\d+\.\d)/;
>   }
>   close FILE;
>
> It gives the following output:
>
> # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> #Listen 12.34.56.78:80
> # e.g., www.apache.org (on) or 204.62.129.132 (off).
>
> I want only a word which contains IP address only not with port and
others..
> For example, Need like:  204.62.129.132  not  (0.0.0.0),12.34.56.78:80,..
.
>
> Regs,
> durai.
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to