SOLVED: Relevance fine tuning - line of file

We have a text file that lives on all of our servers that denotes what group each one belongs to:


I have the following relevance expression:

exists file “C:\operations\group.txt” whose ( line of it is “server-group-1” )

If the content of the file includes any other lines (eg- 2nd line of file has numbers) then the relevance fails.

What is the proper way to express wanting to just check for existence of the single line within the file??

Seems like “line of it contains” would work but that shows false as well in QnA.


Having more than a single line would fail because you are using the singular “line of it”. That will flag an error if there is anything more than a single line in the file - 0 lines, 2 lines, etc.

So you need to use the plural “lines”, and then find whether the line you’re looking for exists in the file. Likewise, using the plural “files” will suppress the error if the file does not exist -

exists lines whose (it = "server-group-1") of files "c:\operations\group.txt"

You can extend that with some handling of extra spaces and mixed-capitalization as well -
exists lines whose (it as trimmed string as lowercase = "server-group-1") of files "c:\operations\group.txt"


Yeah, that works like magic.


Thanks, Jason

Just FYI, you should generally ALWAYS use plural relevance. See here: Getting data from both Native and Wow6432 registry branches

There are some cases where you cannot use plural relevance, like when using equals, but even then there are often workarounds.