Reading line in a Text file as Relevance

I’m trying to use a line in a text file as relevance for an action. It’s simple text file with two set of numbers separated by a comma:

321,1235
1523,1523
1023,1152

I have a Bigfix configuration setting called “ComputerNumber” that corresponds to the numbers in the first column. So I’m trying to have Bigfix look at the line in the file then compare it to the “ComputerNumber”. If it matches it’s relevant for the action.

I tired the following relevance:

(exists (line of it) whose (it as lowercase starts with (value of setting “ComputerNumber” of client))) of file “C:\Test.txt”

That works until I run into a system that starts with the same set of number but has more digits ie 3214 instead of 321.

I tried:

(exists (line of it) whose (it it equals (value of setting “ComputerNumber” of client))) of file “C:\Test.txt”

But that doesn’t work either. I get a False. Any help with this would be great.

Since the file contains two columns/fields of data separated by commas, and you’re trying to compare against one particular field, we’ll have to parse the line to properly perform the comparison. Try something like:

(exists (line of it) whose (preceding text of first "," of it = (value of setting "ComputerNumber" of client))) of file "C:\Test.txt"

2 Likes

Thanks. That works. I didn’t even think about using the comma as a divider.