Durai wrote:

Hi,

It gives the output:

(0.0.0.0)
12.34.56.78:80
204.62.129.132

I need Only IP address. I need like:

204.62.129.132
127.0.0.1


if you want to exclude only 0.0.0.0 , how about
print if /(\d+\.\d+\.\d+\.\d)/ and $1 != "0.0.0.0";

Not like 12.34.56.78:80,(0.0.0.0),..etc.

Thanks,
Durai.

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





this should work

open FILE, "test.txt" or die "Can't open file!: $!";
  while( <FILE> )
  {
     my @parts = split(/\s+/);
     foreach (@parts){
         print if /(\d+\.\d+\.\d+\.\d)/;
     }
  }
  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>






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




Reply via email to