CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Regexpression to extract IPaddress from a file

 



Kishorerp
Novice

Aug 4, 2008, 11:06 PM

Post #1 of 3 (2244 views)
Regexpression to extract IPaddress from a file Can't Post

Hi all
I have a .txt file which is in the below format.I am looking for a Regular expression in perl to extract only the IPAddress
192.168.21.10 WORKGROUP\CKODUQ34 SHARING
192.168.21.62 WORKGROUP\WIN2K SHARING

Kishore


KevinR
Veteran


Aug 4, 2008, 11:40 PM

Post #2 of 3 (2242 views)
Re: [Kishorerp] Regexpression to extract IPaddress from a file [In reply to] Can't Post


Code
if (/(\d+\.\d+\.\d+\.\d+)/) { 
print $1,"\n";;
}

-------------------------------------------------


Kishorerp
Novice

Aug 5, 2008, 12:12 AM

Post #3 of 3 (2239 views)
Re: [KevinR] Regexpression to extract IPaddress from a file [In reply to] Can't Post

Thanks Kevin it worked Smile

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives