Relevance results for two changing lines

I am trying to fetch results for two different lines but want results for both of them in one go no separate analysis.

If line one exists with desired contents true else false, else if line two exists with desired content true else false, else"both not set"… something like that way.

I am trying to run below relevance its working fine for one or another but not giving answer for both of them.

IF exist lines whose (it does not start with "#" AND it contains "*" AND it contains "hard" AND it contains "nofile" AND it contains "8040") of file "c:\temp\ulimit.txt" THEN "Hard 8040 True" ELSE IF exist lines whose (it does not start with "#" AND it contains "*" AND it contains "soft" AND it contains "nofile" AND it contains "8040") of file "c:\temp\ulimit.txt" THEN "Soft 8040 True" ELSE "Not Set"

If OK to return the actual file lines, something like this could work:

lines whose ((it does not start with "#" AND it contains "*" AND it contains "hard" AND it contains "nofile" AND it contains "8040") OR (it does not start with "#" AND it contains "*" AND it contains "soft" AND it contains "nofile" AND it contains "8040")) of file "C:\temp\ulimit.txt"

Otherwise, this likely isn’t the most efficient approach, but one way might be to first check if both conditions exist, then if not, check for each specific condition:

if (number of lines whose ((it does not start with "#" AND it contains "*" AND it contains "hard" AND it contains "nofile" AND it contains "8040") OR (it does not start with "#" AND it contains "*" AND it contains "soft" AND it contains "nofile" AND it contains "8040")) of file "C:\temp\ulimit.txt" = 2) then ("Hard 8040 True";"Soft 8040 True") else if exist lines whose (it does not start with "#" AND it contains "*" AND it contains "hard" AND it contains "nofile" AND it contains "8040") of file "c:\temp\ulimit.txt" THEN "Hard 8040 True" ELSE IF exist lines whose (it does not start with "#" AND it contains "*" AND it contains "soft" AND it contains "nofile" AND it contains "8040") of file "c:\temp\ulimit.txt" THEN "Soft 8040 True" ELSE "Not Set"

1 Like