word search in output

How to get the fisrt word of the output of a shell script .

below command will display the list of baselines in my view .

cmd :

cleartool lsstream -fmt "%[found_bls]NXp\n" -view $VIEW_NAME

Output :

baseline:MHC_BUILDTREE1.0.1
baseline:JEPG_DUIF_CI
baseline:MOR_BuildTree_BLD_I.0.1

I need to search the word "MOR_BuildTree" and that output line i have to save in one variable to execute the rest of the commands .

Can any one give the suggestuon ?

Redirect the output of script to a log.
Grep that log for your pattern.

Are you looking for something else?

Maybe something like below...?

BASE_VAR=$(cleartool lsstream -fmt "%[found_bls]NXp\n" -view $VIEW_NAME |grep 'MOR_BuildTree' ) 
# Or in case above did not work
cleartool lsstream -fmt "%[found_bls]NXp\n" -view $VIEW_NAME | grep 'MOR_BuildTree'