Hi Script Experts,
I have on text file, it generated from wget.exe. ( It is my isp wan ip)
I need one script to extract only the ip address. ( just like 92.99.191.63) only.
Here some time ip will show 256.99.192.123
ip.txt
--------
<html><head><title>Current IP Check</title></head><body>Current IP Address: 92.99.191.63</body></html>
Thanks in advance.
Regards,
Baiju.
Extract IP address from text file.
Moderator: DosItHelp
-
- Posts: 319
- Joined: 12 May 2006 01:13
you can use vbscript
Code: Select all
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objRE = New RegExp
objRE.Pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
objRE.Global = True
objRE.IgnoreCase = False
objRE.MultiLine = True
strFile = "c:\test\file.txt"
strFileContents = objFS.OpenTextFile(strFile).ReadAll
Set colMatches = objRE.Execute(strFileContents)
For Each objMatch In colMatches
WScript.Echo objMatch.Value
Next