Dealing with matching strings from multiple files

Newbe question :smile:
I am trying to develop some content to deploy a JRE patch to our existing Tivoli Monitoring environment. I have 3 different versions of the patch to deal with.

To do that I need to determine the current versions of the JRE that are deployed. To do that I have this.

First I found the files that had the version info I was looking for
(names of files whose ((exists folder “c:\temp\JRE” AND name of it as lowercase ends with “.ver” AND name of it as lowercase starts with “jr”)) of folder “c:\temp\JRE”)
A: jraix523.ver
A: jraix526.ver

Then I pulled the version info out of the files
following texts of lasts “VRMF =” of lines whose (it starts with “VRMF =”) of files whose ((exists folder “c:\temp\JRE” AND name of it as lowercase ends with “.ver” AND name of it as lowercase starts with “jr”)) of folder "c:\temp\JRE"
A: 05161400
A: 07093000

So in this case this system has 2 different versions of JRE installed 05161400 and 07093000 and I would need to patch both of them. So my dilemma comes in how do I store each return value to a unique parameter that I can then later evaluate to see which version/versions of the patch to download and apply. Some systems will only have 1 version while others may have 2 or 3 depending on which agents are installed.

Then I would also like to create relevance that says if any of the installed versions of the JRE do not match the 3 patch levels than it is relevant for this task to be applied.

I’m not going to address your logic for detecting JRE versions. I have to assume you have good reason for reading it out of your text files from c:\temp, rather than a real detection based on JRE registry & file entries.

You’d probably be better off splitting this into three separate fixlets, with each handling a single patch detection. In that instance you’d have a Relevance like

exists files whose (name of it as lowercase starts with "jr" and name of it as lowercase ends with ".ver" and exists lines whose (following texts of lasts "VMRF =" of it contains "05161400") of it) of folders "c:\temp\JRE"

…this should detect the presence of “05161400”. Or maybe I’m to understand that you want only versions 05161400, 07093000, and some third version? If that’s the case, you might look for lines that start with “VMRF =” and then some value that’s not contained by your desired versions -

exists files whose (name of it as lowercase starts with "jr" and name of it as lowercase ends with ".ver" and exists lines whose (it starts with "VMRF =" and following text of last "VMRF =" of it as trimmed string is not contained by set of ("05161400";"07093000")) of it) of folders "c:\temp\JRE"

Yeah was testing on my laptop no ITM installed so just put the files in c:\temp\JRE as I was trying to use the fixlet debugger to figure this out. So on a system that returns the following:

Q: (names of files whose ((exists folder “/opt/IBM/ITM/registry” AND name of it as lowercase ends with “.ver” AND name of it as lowercase starts with “jr”)) of folder “/opt/IBM/ITM/registry”)
A: jraix523.ver
A: jraix526.ver
Q: following texts of firsts “VRMF =” of lines whose (it starts with “VRMF =”) of files whose ((exists folder “/opt/IBM/ITM/registry” AND name of it as lowercase ends with “.ver” AND name of it as lowercase starts with “jr”)) of folder "/opt/IBM/ITM/registry"
A: 05120100
A: 07070000
shouldn’t this return True ??
Q: exists files whose (name of it as lowercase starts with “jr” and name of it as lowercase ends with “.ver” and exists lines whose (it starts with “VMRF =” and following text of last “VMRF =” of it as trimmed string is not contained by set of (“05161400”;“06162000”;“07093000”)) of it) of folders "/opt/IBM/ITM/registry"
A: False

Yes, that should return true. It does on my machine. Can you paste in a result from this query? I’m interested in any kind of odd spacing or unprintable characters that might be embedded.

q: ("%22" & it & "%22") of lines whose (it starts with "VMRF =") of files whose (name of it as lowercase starts with "jr" and name of it as lowercase ends with ".ver" ) of folders "/opt/IBM/ITM/registry"

Seems to output nothing

Q: ("%22" & it & “%22”) of lines whose (it starts with “VMRF =”) of files whose (name of it as lowercase starts with “jr” and name of it as lowercase ends with “.ver” ) of folders "/opt/IBM/ITM/registry"
T: 1515

and I ran this just to make sure it was returning data

Q: following texts of firsts “VRMF =” of lines whose (it starts with “VRMF =”) of files whose ((exists folder “/opt/IBM/ITM/registry” AND name of it as lowercase ends with “.ver” AND name of it as lowercase starts with “jr”)) of folder "/opt/IBM/ITM/registry"
A: 05120100
A: 07070000
T: 8267

and if it helps here is the contents of the 2 files
cat /opt/IBM/ITM/registry/jraix523.ver

Version file for jr - Tivoli Enterprise-supplied JRE

AIX R5.2 (32 bit)

Product description.

desc = Tivoli Enterprise-supplied JRE

Release level.

ver = 512
rel = 100

Alternate Directory for Agent Version Parity

altDir=tmaitm6
VRMF = 05120100

#Build level
build = d1075a

Supported architectures.

runArch = aix523
runArch = aix533

Product family or families.

family = all

Packaged components.

comp = ALL

Size in uncompressed kilobytes of each component.

sizeALL = 144296

Prerequisite products. Format is: preReqcomp = pkg_name|version|release|pkg_comp||

preReqALL = none

numElements=1

cat /opt/IBM/ITM/registry/jraix526.ver

Version file for jr - Tivoli Enterprise-supplied JRE

AIX R5.2 (64 bit)

Product description.

desc = Tivoli Enterprise-supplied JRE

Release level.

ver = 707
rel = 100

Alternate Directory for Agent Version Parity

altDir=tmaitm6
VRMF = 07070000

#Build level
build = 201405131928

Supported architectures.

runArch = aix526
runArch = aix536

Product family or families.

family = all

Packaged components.

comp = ALL

Size in uncompressed kilobytes of each component.

sizeALL = 405832

Prerequisite products. Format is: preReqcomp = pkg_name|version|release|pkg_comp||

preReqALL = none

numElements=1

Yes that does help a lot. In my first posting I transposed “VRMF” into “VMRF”, and you picked that up when you copied mine. Try fixing that and see if it works.

Thanks for all your help Jason, Sorry I didn’t reply sooner. This is what I ended up with

exists files whose (name of it as lowercase starts with “jr” and name of it as lowercase ends with “.ver” and exists lines whose (it starts with "VRMF = " and following text of firsts "VRMF = " of it as trimmed string is not contained by set of (“05161400”;“06162000”;“07093000”)) of it) of folders “/opt/IBM/ITM/registry”

and then used this to download the right version for JRE patch

if {(following text of firsts "VRMF = " of lines whose (it starts with "VRMF = 07") of files whose ((exists folder "/opt/IBM/ITM/registry" AND (name of it as lowercase = "jraix523.ver" OR name of it as lowercase = "jraix526.ver" OR name of it as lowercase = "jrls3266.ver" OR name of it as lowercase = "jrlx8266.ver"))) of folder "/opt/IBM/ITM/registry" != "07093000")|false}
	parameter "jreImage" = "ITM_7.09.30_JRE.tar"
	parameter "jreImageSize" = "1507266560"
	parameter "jreImageSha1" = "6997c9e8c015578da4058730c82f2e0cd931257a"
elseif {(following text of firsts "VRMF = " of lines whose (it starts with "VRMF = 06") of files whose ((exists folder "/opt/IBM/ITM/registry" AND (name of it as lowercase = "jraix523.ver" OR name of it as lowercase = "jraix526.ver" OR name of it as lowercase = "jrls3266.ver" OR name of it as lowercase = "jrlx8266.ver"))) of folder "/opt/IBM/ITM/registry" != "06162000")| false}
	parameter "jreImage" = "ITM_6.16.20_JRE.tar"
	parameter "jreImageSize" = "1911900160"
	parameter "jreImageSha1" = "76ee786e7f722ee011cef1e256cc0c860a332dd7"
else
	parameter "jreImage" = "ITM_5.16.14_JRE.tar"
	parameter "jreImageSize" = "1280522240"
	parameter "jreImageSha1" = "3968d870bb90abf15e8fd1d9286e0992bb94c606"
endif

add prefetch item name={parameter “jreImage”} sha1={parameter “jreImageSha1”} size={parameter “jreImageSize”} url=http://localhost:52311/Uploads/{parameter “jreImageSha1”}/{parameter “jreImage”}