Read A Logfile And Grab Some Text Between

Let's say you have a logfile with data between "….data"

To grab the tekst between the quotes do as follows:

A VBScript solution: 
======== 
Option Explicit 
Dim strLogFile, objFSO, objLog, strLine 
Dim intIndex1, intIndex2, strServer 
Const ForReading = 1 
strLogFile = "c:\Scripts\Example.log" 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objLog = objFSO.OpenTextFile(strLogFile, ForReading) 
Do Until objLog.AtEndOfStream 
    strLine = objLog.ReadLine 
    intIndex1 = InStr(strLine, """") 
    intIndex2 = InStr(intIndex1 + 1, strLine, """") 
    If (intIndex1 > 0) And (intIndex2 > intIndex1) Then 
        strServer = Mid(strLine, intIndex1 + 1, intIndex2 - intIndex1 - 1) 
        Wscript.Echo strServer 
    End If 
Loop 
objLog.Close
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License