'PIPE stem dirstem.' ,
   '| find BUILD',
   '| specs word -1;-1 1' ,
   '| var LastWord'

And maybe throw in a 'take 1' to stop reading the stem if there's only one 
occurrence of a line beginning with BUILD?

-----Original Message-----
From: CMSTSO Pipelines Discussion List [mailto:[email protected]] On 
Behalf Of Gentry, Steve
Sent: Tuesday, March 03, 2015 12:32 PM
To: [email protected]
Subject: Re: getting the last word

That works.
Thanks.

-----Original Message-----
From: CMSTSO Pipelines Discussion List [mailto:[email protected]] On 
Behalf Of Rob van der Heij
Sent: Tuesday, March 03, 2015 12:29 PM
To: [email protected]
Subject: Re: getting the last word

Spec w -1
On Mar 3, 2015 6:28 PM, "Gentry, Steve" < [email protected]> 
wrote:

> I have a variable with words in it and I want to get the last word in 
> the string.
> I came up with the following solution although I don't think it is 
> very elegant (because of the multiple stages).
> 'PIPE stem dirstem.' ,
>      '| find  BUILD' ,
>      '| split' ,
>      '| take last' ,
>      '| var LastWord'
>
> I was wondering if there was a stage or maybe something in SPEC that 
> would allow me to do this on one line rather than the two (split and 
> take last) that I'm using now.
>
> Thanks,
> Steve
>

Reply via email to