Hi, I’m trying to parse a value from a file like this (version may not always be on third line):
#some text
#Sun Mar 16 11:02:28 EDT 2025
installed.version=8.x.x.x.x
with this relevance and assign that value (8.x.x.x.x) to a property “such-n-such-version”:
(substring after “installed.version=” of it) of (line of file “/pathtofile/servername/installed.version”)
note there is a server name in the path, so will need to wildcard it somehow. I have tried many variations of this relevance, but keep getting various different errors like “Singular expression refers to nonexistent object.” Thanks, for any help!
Hey @gus, That seems to be a step in the right direction… no error now, just ‘none’ as value… does the * in the path cause any problems? Thanks, for your help!
Is “/pathtofile/servername/installed.version” the source file to get the version from? I am assuming this is not an UNC path, this is a path to a file located in a folder?
Do you have a list of server names or you need it to scan the entire folder and get the same file name under each sub folder?
Do you also need to know the action to put the data into a property?
Hey @D.Dean, Yes the “/pathtofile/-servername-/installed.version” is the source of the version… No not unc, just file path on linux box… server name in the path will be unique on each box, but rest pf path is the same on each box… Yes, it would be very helpful to know what action would put the version into the property… thanks!
btw I am using “/pathtofile/*/installed.version” as the path currently where the asterisk is the servername…
Hi @bigfixit, I would not put a wildcard “*” in the path. Here is some additional information as I’ve attempted to recreate your ask. Notice that I don’t use the name of my server in this example below and my path begins at /tmp.
Q: following texts of firsts "=" of lines whose (it starts with "installed.version=") of files "installed.version" of folders of folders "/tmp"
A: 8.x.x.x.x
T: 3859
Q: pathnames of files "installed.version" of folders of folders "/tmp"
A: /tmp/rhelserver04/installed.version
T: 364
@bigfixit can you please provide a sample of this file?
There are different inspectors for text files, XML, Json etc… so if we have the source it will help ,make sure to remove any sensitive information
Thanks @gus, unfortunately, the server name is hardcoded in the path to the source file on each server… and, I have no way that I know of to create a relevance that would use the server’s actual name and substitute it in the path as a parameter…
@D.Dean, Unfortunately, there are potentially 100’s of servers where the software is installed. It sounds like I would have to write that many relevances…
@bigfixit did you test the relevance that I provided. Make 1 modification to the relevance and simply replace “/tmp” with the path to the server name directory. So if this is the directory path to your file: /pathtofile/servername/installed.version
Then simply replace /tmp with /pathtofile. Don’t include a wildcard or servername in the path. What is the results?
@gus, I am trying now… it looks like it is coming back as ‘none’. So, I am trying to reach the server owners to verify the path and file that they gave me is actually there… I’ll let you know what they say… thanks, for your help so far.
Q: following texts of firsts "=" of variables whose (it starts with ".installed.version") of files "installed.version" of folders ("/etc/" & (computer name as lowercase))
A: 8.x.x.x.x
If the folder name is the same case as the hostname you may need to avoid casting computer name as lowercase, and change “etc” to whatever your “pathtofile” is