Finding line containing value then retrieving next line for Analysis

(imported topic written by richardhsu91)

Hi

I’m new to BigFix and have been reading documentation and forums trying to figure out a way to do the following:

I have a text document say filename.txt on all the computers with some information like this, somewhere in the file but not necessarily in the same location from computer to computer:

=======================================

Irrelevant information to my need

Category Name:

Scope: Information Information Information

More irrelevant information to my need

=======================================

I am trying to write a fixlet that would be able to go to each system find the line with “Category Name:” (which is unique in the file) and then retrieving the next line starting “Scope: Information Information Information”

Is there anyway to do this?

Most I could do was “lines of file filename.txt” but I don’t need the whole text file information which is a lot of information.

  • Thank you

(imported comment written by Lee Wei)

Here are some example statements for you. The one you want is at the end.

q: if (exists file “c:\temp\filename.txt”) then (“Place holder for the statement”) else (“No file”)

q: (line number of lines whose (it starts with “Category Name:”) of file “c:\temp\filename.txt”) + 1

q: lines whose (line number of it = 999) of file “c:\temp\filename.txt”

q: lines whose (line number of it = (line number of lines whose (it starts with “Category Name:”) of file “c:\temp\filename.txt”) + 1) of file “c:\temp\filename.txt”

q: if (exists file “c:\temp\filename.txt”) then (lines whose (line number of it = (line number of lines whose (it starts with “Category Name:”) of file “c:\temp\filename.txt”) + 1) of file “c:\temp\filename.txt”) else (“No file”)

(imported comment written by richardhsu91)

For some reason there is no output. It just gives a time run from the debugger.

Is this normal?

I’ll probably look for another way then, thanks. Probably just look into a script to run to help me do this.

(imported comment written by Lee Wei)

Probably means that the Category Name string is not found.

For example, change “starts with” to “contains” in case you have a tab character in the line.