Tuple string not working

(imported topic written by jrbast)

With the following data in a file:

Console : ibmhmc8,ibmhmc10 Rack : F-08 Location : cbc

I want to return the last value on the line ( ie the “cbc”

Using the following command does not work… I’m thinking the “,” between that ibmhmc8,ibmhmc10 is causing issue

Q: tuple string item 3 of concatenation ", " of substrings separated by “:” of line whose ( it contains “Location” ) of file “/opt/sni/unix/etc/mojo.out” as trimmed string

E: Singular expression refers to nonexistent object.

Is there a better way to get this data??

Thanks, Jeff

(imported comment written by NoahSalzman)

Taking a different approach, one way to do it would be:

q:
lines
of
file
"c:\test.txt"

A:
Console : ibmhmc8,ibmhmc10 Rack : F-08 Location : cbc

q:
following texts
of
last
":"

of
line
whose
(
it

contains

“Location”
)
of
file
"c:\test.txt"

as
trimmed string

A:
cbc

Also, the tuple string item inspector requires string separated with only one space after the comma:

q:
tuple string
item

0

of

“foo, bar, baz”

A:
foo

q:
tuple string
item

0

of

“foo,bar, baz”

E:
Singular expression refers to nonexistent object.

Which leads us to:

q:
tuple string
item

3

of
concatenation
", "

of
substrings separated by
":"

of
concatenation
"you have an extra comma from those two machines names and it is messing up your comma substitution"

of
substrings separated by
","

of
line
whose
(
it

contains

“Location”
)
of
file
"c:\test.txt"

as
trimmed string

A:
cbc

(imported comment written by jgstew)

I’d recommend:

following texts of lasts "Location : " of lines whose ( it contains "Location : " ) of files “c:\test.txt” as trimmed string

The reason is that it contains “Location” does not actually check for the “:” character, while "Location : " does. You should not split a string based upon a character you have not asserted exists within it first for error checking reasons. I feel it is better to use the entire token that precedes the data of interest symmetrically in both the “it contains” and “lasts” statement. I also changed the singulars into plurals which removes some of the need for error checking. A singular relevance statement implies that it must return exactly one result, no more no less, while a singular statement implies 0 or more results. I recommend plural for reporting and existence purposes. For relevance substitution, it depends - sometimes singular would be better for deterministic reasons… in actionscript it is often better to fail with errors than to continue in an unexpected state.