Forum Discussion

thexder1's avatar
thexder1
Contributor
12 years ago

searching a log file

I am trying to search a log file to see if there are more than 1 instance of  a specific term. Currently I am reading the file one line at a time using aqFile.ReadLine() and using aqString.Find() to search the line for the term. The problem is that this takes a long time on a several thousand line log file. Is there a faster way of doing this? I see that I can read the entire file into a string but I am not sure that a string can handle possible a couple of MB of text.
  • That does not really answer my question. I can search it is just very slow, partly because the logfiles can be several MB. Would I just stream the entire file to a regular expression? If so how would I accomplish that? Also I do not really need anything that fancy as the string that I am looking for will always be at the end of a line. I really just need to know how many times it occurrs in the log file.



    Also this has nothing to do with the TestComplete logs, this is the logs in the program that I am testing. I am using this as part of the checks to see if the test passed or failed.
  • I think I have found it, still trying to get it to run and no idea how long it will take yet.