Find the answer to your Linux question:
Results 1 to 2 of 2
Hi I have below script Code: getServiceStatus() { hst=$1 /opt/Avaya/CCR/iqci/bin/expectScripts/iqciRunCommand.exp 3600 $hst root /avaya/password "/opt/coreservices/lifecycle/bin/lc ls" > /tmp/tmp_get_service_status.txt echo "debug1 : getservicestatus : svcuuid : $SVCUUID" #SVCUUID=`echo "$SVCUUID" | tr ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    5

    grep statement proble


    Hi

    I have below script
    Code:
    getServiceStatus() {
       hst=$1
       /opt/Avaya/CCR/iqci/bin/expectScripts/iqciRunCommand.exp 3600 $hst root /avaya/password "/opt/coreservices/lifecycle/bin/lc ls" > /tmp/tmp_get_service_status.txt
    
            echo "debug1 : getservicestatus : svcuuid : $SVCUUID"
            #SVCUUID=`echo "$SVCUUID" | tr -d ' '`
            echo $SVCUUID
    div=$SVCUUID
    echo "div is $div"
    #       cat /tmp/tmp_get_service_status.txt | grep " : " |  grep $div
            #grep $SVCUUID /tmp/dk.txt
            echo "return code is $?"
            SVCLINE= `grep  $SVCUUID /tmp/tmp_get_service_status.txt`
      echo "debug2:" $SVCLINE
       SVCNAME=`echo $SVCLINE | cut -d ':' -f 2`
       SVCSTAT=`echo $SVCLINE | cut -d ':' -f 3`
            echo "debug : getServiceStatus : line : $SVCLINE"
            echo "debug : getServiceStatus : name : $SVCNAME"
            echo "debug : getServiceStatus : status : $SVCSTAT"
    }
    Output is
    Code:
    debug: pattern : BIAdminService|BINodeManagerService : host : garlic
    debug : uuid list : 0789d6c13b9168cb013b9168d08c0001
    debug : uuid list : 0789d6c13b9168cb013b9168d08c0001
    debug : startservice : uuid : 0789d6c13b9168cb013b9168d08c0001
    debug : startservice : host : garlic
    debug1 : getservicestatus : svcuuid : 0789d6c13b9168cb013b9168d08c0001
    0789d6c13b9168cb013b9168d08c0001
    div is 0789d6c13b9168cb013b9168d08c0001
    return code is 0
    debug2:
    debug : getServiceStatus : line :
    debug : getServiceStatus : name :
    debug : getServiceStatus : status :
    debug : startservice : status :
     was not found in 'lc ls'cb013b9168d08c0001

    My query is


    echo $SVCUUID is displayed the outpt is 0789d6c13b9168cb013b9168d08c0001

    but when i used it in grep statement
    Code:
    SVCLINE= `grep  $SVCUUID /tmp/tmp_get_service_status.txt`
    then no output is there
    it didn't displayed any thing


    Please suggest where i am wrong

    Thanks in Advance

    Samit
    Last edited by atreyu; 12-19-2012 at 11:43 PM. Reason: added CODE tags for readability

  2. #2
    Just Joined!
    Join Date
    Dec 2009
    Location
    California
    Posts
    98
    Remove the space...

    SVCLINE=`grep $SVCUUID /tmp/tmp_get_service_status.txt`

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •