Using parameter "VALUE"={a relevance statement}

(imported topic written by SystemAdmin)

I have a file containing the following lines:

root # cat /tmp/mojo.out

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

Hostname : CBCibmadmin Status : active

Type : prod MaintMode : NO

Console : ibmhmc4,ibmhmc6 SNI Tag : p520-02

OS Vendor : ibm

Location : cbc Rack : L-08

Model : 9111-520 BkupDay : no

Serial : 100411e SHAMU Menu : N

Function : admin Class : infrastructure

Qrel : Planning :

Description

UNIX Team Admin Server

Notes

I want to create a task to grab the line containing “Function : admin” and return the value “admin” placing into a parameter named “FUNCTION”, then use an if statement to set a custom field named “Quest” to a value of “True”. Is the following correct???

parameter “FUNCTION” = "{(tuple string item 3 of concatenation “, " of substrings separated by " " of line whose ( it contains “Function” ) of file “/tmp/mojo.out”)}”

if {(parameter “FUNCTION”) = “admin”}

setting “Quest”=“True” on {now} for client

endif

(imported comment written by Bill.Ehardt)

Don’t forget to start at 0, not 1. In this case tuple string item 3 is “Class”

Otherwise it looks right.

(imported comment written by NoahSalzman)

“tuple string” is Windows only. There is a bug open to migrate that operator to mac/unix.

In the mean time, try this:

parameter "FUNCTION" = "{(following text of first ":" of preceding text of first "Class" of line whose ( it contains "Function" ) of file "/tmp/mojo.out") as trimmed string}"  
 
if {(parameter "FUNCTION") = "admin"}  
setting "Quest"="True" on "{now}" for client  
endif

That parameter relevance substitution relies on the format of mojo.out being fairly static.

(imported comment written by NoahSalzman)

I was wrong,

tuple string item n

does exist on linux/unix (at least in recent versions) but not on Mac.