Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   Vbscript to grab ip addresses from a text file (http://www.go4expert.com/forums/vbscript-grab-ip-addresses-text-file-t23216/)

Cleptography 6Sep2010 06:53

Vbscript to grab ip addresses from a text file
 
This one here is a vbscript that grabs all the ips from a text file. Modifiy the file name section to point to the file you are using. I use this one mostly for parsing wireshark output.

Vbscript to grab ip addresses from a text file
----------------------------------------------------
Code:

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Your File Name Here.txt", ForReading)

strSearchString = objFile.ReadAll

objFile.Close

Set objRegEx = CreateObject("VBScript.RegExp")

objRegEx.Global = True 
objRegEx.Pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"

Set colMatches = objRegEx.Execute(strSearchString) 

If colMatches.Count > 0 Then
    For Each strMatch in colMatches 
      Wscript.Echo strMatch.Value
    Next
End If



All times are GMT +5.5. The time now is 04:26.