variable= 'cat file|wc -l' String problems

Hi,
does anybody knows about wc -l, how to transform it inot a just number?
this script ALWAYS executes the command3!!, However, the value of BMU_RUNNING is 1

case $BMU_RUNNING in
*0) command1
;;

 *1\) command 2;;


  *\)command 3;;

esac
The variable is
BMU_RUNNING=`more channels.dat|grep BMU |grep RUNNING|wc -l`
and it is equal to 1
echo $BMU_RUNNING is 1
but with set -x
+ + more channels.dat
+ grep BMU
+ grep RUNNING
+ wc -l
BMU_RUNNING= 1

thanks for your help
Santiago

Can you try this

grep -c BMU_RUNNING channels.dat

instead of

grep |wc -l

combination?

Here's a test script:

#!/bin/sh

BMU_RUNNING=`grep -c BMU_RUNNING channels.dat`
case "$BMU_RUNNING" in
*0) echo it is "* zero";;
*1) echo it is "* one";;
*) echo it is "*";;
esac

and here's the test channels.dat file.

ASDJS
DBMU
BMU_RUNNING
AKLJFIDF
ASJDKSJD

It gave the expected output.

Try to Get rid of the * in front of the 0 and 1 and see if that works.

thanks blowtorch
that worked, I just modifiyes as my chnnels.dat file is something like:
CHANNEL(TO.BMUUZA1) STATUS(STOPPED)
CHANNEL(TO.YMQ2) STATUS(RUNNING)
CHANNEL(TO.BMUUZA1) STATUS(RUNNING)
CHANNEL(TO.YMQ1) STATUS(RUNNING)

to BMU_RUNNING=`grep BMU channels.dat|grep -c RUNNING`

case $BMU_RUNNING in
*0) echo `date`" WARNING, No Mainframe Channels TO.BMUAA1 are running "
echo " Please, start the channels or contact Mainframe transaction sy
stems team"
;;

 *1\) echo \`date\`" One Mainframe Channels TO.BMUAA1 not running "
     echo  " Please, start the channel or  contact Mainframe transaction sys

tems team"
;;

  *\);;

esac

Thanks again so much
Santiago