How to determine if specific text appears in a log file

(imported topic written by Matt.Johnson)

I need to use Relevance to determine if a sting exist in a .log file (basically a .txt file) and give a TRUE/FALSE result.

I am still a bit new to writing this code, so any assistance is greatly appreciated.

(imported comment written by cstoneba)

here’s a couple ways. the first just checks the file, the second makes sure that the file first exists.

exists lines whose (it as lowercase contains “blah”) of file “c:\file.log”

if (exists file “c:\file.log”) then (exists lines whose (it as lowercase contains “blah”) of file “c:\file.log”) as string else “File Doesn’t Exist”

(imported comment written by Matt.Johnson)

Thank you for your quick response cstoneba!

However, when I try that it the result is always False even know I can open the file in Notepad and do a Find it and found multiple instances of the string. Any ideas why?

Thanks again!

(imported comment written by Matt.Johnson)

I found it.

The string I was looking for contained CAPS so “it as lowercase” can search all day and not find anything.

Correcting the statement to:

exist lines whose (it as lowercase contains “MD009E0” as lowercase) of file “C:\Path\Folder\file.log” fixed the glitch.