Login   /   Register

Count how many Times the Word "Error" Appears in a Text File

Rate this article
     1 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 5
Loading ... Loading ...
April 1st, 2008 by daniva

Google Search Results

You arrived here after searching for the following phrases:

Click a phrase to jump to the first occurrence, or return to the search results.

the first thought is to use the InStr function to see if the word "Error" appears anywhere in each line of the log file; you could then keep a running tally of the number of times you found the word, a technique remarkably similar to the one we demonstrated in yesterday’s column. That was a good idea, but, as you discovered, there was one major flaw in the plan: technically your log file has only one line in it. Consequently, your script always reported that it found one instance of the word Failure, regardless of how many instances actually existed. "But I’m stuck," you wrote, "because there’s no way to break this single line into multiple lines."

The content you are accessing is for registered users only
Registeration is FREE, quick and private.
You can either Register or Login if you have already registered

Posted in VBScript

Leave a Reply

You must be logged in to post a comment.

This article was viewed 411 times