Re: VB Script that searches a file for different text, with an app
- From: njmike <njmike@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Oct 2008 13:53:00 -0700
"Pegasus (MVP)" wrote:
"njmike" <njmike@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A0DC18CE-BF54-4C1E-A78F-32D7A4676F22@xxxxxxxxxxxxxxxx
I'm trying to do the following and not having much luck.
I need a script that opens a text log, once opened it searches for a
unique
identifyer that resides near the top of the file and looks something like
this:
"running with process name
USSECAVDMPAPP1Cell01\USSECAVDMPAPP28Node01\server55" (I'm only really
interested in the "server55" piece, but can make due with the entire
string.
The script then needs to continue parsing the file for error conditions
which look like this:
"There is/are 1 thread(s) in total in the server that may be hung"
There could be multiple instances of that error message.
What I would like to do is write to a seperate file the uniqueID, pluss
error message, something similiar to this:
There is/are 1 thread(s) in total in the server that may be hung on
server55.
Any assistance would be greatly appreciated.
Regards,
Mike
Let's have a look at what you've got so far. We can probably built in that.
Appreciate your time Pegasus, Here's what I have so far:
Const ForReading = 1
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("testIn.txt")
Do Until objFile.AtEndOfStream
strText = objFile.ReadLine
If InStr(strText, "running with process name") Then
arrText = Split(strText, "and process id")
strVariable = arrText(0)
'Exit Do
ElseIf InStr(strText, "There is/are") Then
arrText = Split(strText, "in total in the server")
strVariable1 = arrText(0)
Exit Do
End If
Loop
objFile.Close
Wscript.Echo strVariable
Wscript.Echo strVariable1
The issue this is having is its grabbing the right server string and echoing
that back, then it gets the error info - but only the first instance of it.
There are multiple instances after, which I can't get it to loop to.
.
- Follow-Ups:
- Re: VB Script that searches a file for different text, with an app
- From: Pegasus \(MVP\)
- Re: VB Script that searches a file for different text, with an app
- References:
- VB Script that searches a file for different text, with an append.
- From: njmike
- Re: VB Script that searches a file for different text, with an append.
- From: Pegasus \(MVP\)
- VB Script that searches a file for different text, with an append.
- Prev by Date: Re: VB Script that searches a file for different text, with an append.
- Next by Date: VBScript to exe with Windows
- Previous by thread: Re: VB Script that searches a file for different text, with an append.
- Next by thread: Re: VB Script that searches a file for different text, with an app
- Index(es):
Relevant Pages
|