Hi, When there are several results, my attempt to read the lines, extract the version string from it, and compare it with another version fails. Can you help?
Q: lines of file (pathname of parent folder of data folder of client & "\curl_results.txt")
A: /usr/bin/curl,curl 7.79.1,libcurl/7.79.1
A: /opt/puppetlabs/puppet/bin/curl,curl 7.86.0,libcurl/7.86.0
A: /usr/bin/curl,curl 7.29.0,libcurl/7.29.0
T: 0.994 ms
Q: (following texts of firsts "curl " of preceding texts of firsts ",l" of lines of file (pathname of parent folder of data folder of client & "\curl_results.txt") as string)
A: 7.79.1
A: 7.86.0
A: 7.29.0
T: 0.814 ms
Q: concatenation " || " of substrings separated by "," of (lines whose (((following text of first "curl " of preceding texts of firsts ",l" of lines of file (pathname of parent folder of data folder of client & "\curl_results.txt") as string) >= "7.69.0") AND ((following text of first "curl " of preceding texts of firsts ",l" of lines of file (pathname of parent folder of data folder of client & "\curl_results.txt") as string) <= "8.3.0")) of file (pathname of parent folder of data folder of client & "\curl_results.txt"))
A: /usr/bin/curl || curl 7.79.1 || libcurl/7.79.1
T: 2.102 ms
failing if lines are multiple -
Q: (concatenation " || " of substrings separated by "," of it) of lines whose (((following text of first "curl " of preceding texts of firsts ",l" of lines of file (pathname of parent folder of data folder of client & "\curl_results.txt") as string) >= "7.69.0") AND ((following text of first "curl " of preceding texts of firsts ",l" of lines of file (pathname of parent folder of data folder of client & "\curl_results.txt") as string) <= "8.3.0")) of file (pathname of parent folder of data folder of client & "\curl_results.txt")
T: 2.602 ms
What exactly is the comparison logic you are after? Do you want ANY of them that are below 8.3? Do you want to check if ALL of the are below?
Here are a few examples (I purposely start from the results of your 2nd query) but you can easily add your logic:
q: /* checks if ANY of the versions are within criteria */ exists ("7.79.1"; "7.86.0"; "7.29.0") whose (it as version < "8.3.0" and it as version >= "7.69.0")
A: True
T: 0.203 ms
I: singular boolean
q: /* checks if ALL of the versions are within criteria */ (tuple string item 0 of it as boolean AND tuple string item 1 of it as boolean AND tuple string item 2 of it as boolean) of concatenation ", " of (it as string) of ((it as version < "8.3.0" and it as version >= "7.69.0") of ("7.79.1"; "7.86.0"; "7.29.0"))
A: False
T: 0.156 ms
I: singular boolean
Depending on what your intention it, you can easily use minimum and maximum versions as I would imagine you are seeking some kind of standardization and to bring to some kind of overall compliance…
q: (it < "8.3.0" and it >= "7.69.0") of maximum of (it as version) of ("7.79.1"; "7.86.0"; "7.29.0")
A: True
T: 0.215 ms
I: singular boolean
q: (it < "8.3.0" and it >= "7.69.0") of minimum of (it as version) of ("7.79.1"; "7.86.0"; "7.29.0")
A: False
T: 0.114 ms
I: singular boolean
My mistake; it appears that I failed to make myself clear in my request.
My first goal was to go over these file lines and extract the version information from them, and it was successful.
2nd, to elaborate further, when I attempted to compare the file’s created versions of the lines, the findings for all of the lines were inconsistent. My best guess is that it is only processing the first line. I’ve achieved nothing as a result.
I’ll be at a computer a bit later today, but the root problem is that you are re-reading the lines of the file on each comparison - in effect comparing each line to every other line.
The comparisons you need will look something like
Lines whose ( (it as version >= "7.69.0" and it as version < = "8.3.0") of (preceding text of first "," of following texts of first ",curl" of it)) of files (path to file)
I added a couple of sample entries to show they’re filtered out.
q: lines of files ("c:\temp\test.txt")
A: /usr/bin/curl,curl 7.79.1,libcurl/7.79.1
A: /opt/puppetlabs/puppet/bin/curl,curl 7.86.0,libcurl/7.86.0
A: /usr/bin/curl,curl 7.29.0,libcurl/7.29.0
A: /usr/bin/othertest/curl,curl 7.0.0,libcurl/7.0.0
A: /usr/bin/othertest8/curl,curl 9.0.0,libcurl/9.0.0
T: 1.677 ms
I: plural file line
q: lines whose ( (it as version >= version "7.69.0" and it as version <= "8.3.0") of (preceding text of first "," of following texts of first ",curl" of it)) of files ("c:\temp\test.txt")
A: /usr/bin/curl,curl 7.79.1,libcurl/7.79.1
A: /opt/puppetlabs/puppet/bin/curl,curl 7.86.0,libcurl/7.86.0
T: 0.830 ms
I: plural file line
but when I am trying to split substrings, everything is going into one line!?
Q: concatenation " || " of substrings separated by "," of (Lines whose ((it as version >= "7.69.0" AND it as version <= "8.3.0") of (following texts of firsts "curl " of preceding texts of firsts ",l" of it)) of file (pathname of parent folder of data folder of client & "\curl_results.txt"))
A: /usr/bin/curl || curl 7.79.1 || libcurl/7.79.1 || /opt/puppetlabs/puppet/bin/curl || curl 7.86.0 || libcurl/7.86.0
T: 0.815 ms
Put the concatenation inside a parentheses so that it deals with each result separately. Try
Q: (concatenation " || " of substrings separated by "," of it) of (Lines whose ((it as version >= "7.69.0" AND it as version <= "8.3.0") of (following texts of firsts "curl " of preceding texts of firsts ",l" of it)) of file (pathname of parent folder of data folder of client & "\curl_results.txt"))