Query Text file for existence of various text strings (or)

This is gonna be really simple I know - I just can’t seem to get it so please ignore my newbness

I am creating an analysis to query test.txt

This works:
Q: if exists file “C:\Users\John\Documents\test.txt” whose ( exists (lines whose ( it contains “test” ) of it )) then “Found” else “Not Found”

however I fail in the syntax to use for when I want to look for one word OR another

So if I wanted to find “test” or “new test” in the text file.

Can anyone help?

You pretty much have it :slight_smile:

We can add the ‘OR’ logic directly in the whose filter:

if (exists file "C:\Users\John\Documents\test.txt" whose ( exists (lines whose ( it as lowercase contains "test" as lowercase OR it as lowercase contains "new test" as lowercase) of it )) ) then "Found" else "Not Found"

4 Likes

Brilliant! Thanks Aram!

I had tried the OR but hadn’t though that each or would need a contains too which is where I was failing. Works a treat now :slight_smile: