Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Build forge command for replace or substring.

Hello

Is there any way to do substring or replace of value of a variable in build forge?  I need to truncate the last 5 characters of a variable in Build forge. I am running Project in Windows only.


1 vote



3 answers

Permanent link
 There are no native substring commands for doing substrings in Build Forge, however I experimented on the Windows shell and found that this general command will do what you want:
.bset env "subVar=`echo %testVar:~0,5%`"
Where subVar is the first 5 characters of the variable.  You will have to tweak it to remove the last 5 characters, but that should get you started.

~Spencer

1 vote


Permanent link
This works but with the defualt value only. what I am doing is I am assigning a dynamic value using bset. Then I am echo the value. Then I do the command that you have mentioned but it printing "defau" means the default value only it is breaking from 0 to 5 characters.

Is there any Idea to make this thing work with dynamic value as well.
# This works
.bset env1 "testVar='`echo helloworld`'
# this works and prints the helloworld
echo $testVar
# Your stuff
.bset env "testVar2=`echo %testVar:0,5%`"
# This prints the defau as the initial value of the testVar is default.
echo $testVar2


Any idea on that ?


0 votes


Permanent link
 What you are describing is .tset.  The .bset command will only take affect after the current step, to affect the current step (and only the current step) you want .tset.  So you would need to .tset testVar and then .bset testVar2, assuming you want the value of testVar2 to persist beyond this step and not testVar.

~Spencer

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,953
× 562

Question asked: Feb 22 '13, 1:38 a.m.

Question was seen: 5,150 times

Last updated: Feb 25 '13, 8:38 a.m.

Confirmation Cancel Confirm