8 Replies Latest reply on Feb 25, 2008 12:20 PM by Troy Barger

    BLCLI output question

      Is the a way to tell BLCLI to out put it's result in a specific case?

      For example, if I want to get a list of all servers, I would do


      blcli Servers listAllServers


      but I would like all the servers to come out in upper case.

        • 1. Re: BLCLI output question


          echo "foo" | awk '{print toupper($1)}'

          in NSH will output FOO.


          So, what you could do is this:


          SERVERLIST=`blcli Server listAllServers`

          echo $SERVERLIST | awk '{print toupper($1)}'


          You might need to put that in a 'foreach' loop so that it converts each line into uppercase.


          foreach SERVER in `echo $SERVERLIST`


          echo $SERVER | awk '{print toupper($1)}'



          I haven't tested this at all but it should give you what you need.

          • 2. Re: BLCLI output question

            Ok, just tested this. You will need to put it in a loop.


            gkullberg-T60% SERVERLIST="server1

            dquote> server2

            dquote> server3

            dquote> server4"


            gkullberg-T60% echo $SERVERLIST

            server1 server2 server3 server4



            gkullberg-T60% echo $SERVERLIST | awk '{print toupper($1)}'


            gkullberg-T60% foreach SERVER in `echo $SERVERLIST`

            foreach> do

            foreach> echo $SERVER | awk '{print toupper($1)}'

            foreach> done






            • 3. Re: BLCLI output question
              Bill Robinson

              you can also use tr instead of awk - so replace the awk command in greg's example w/:


              tr '[:lower:]' '[:upper:]'


              the blcli has to be run from either nsh or unix prompt. this doesn't work if you run this in a dos cmd window directly.

              • 4. Re: BLCLI output question

                Thanks Greg!

                I'm using this to populate an array from EMC's Operations Manager, would this still work in an NSH scenario?

                • 5. Re: BLCLI output question

                  I thought it might help if you could see my subroutine.


                  def findAllServers():

                  svrsBlobStat = jli.run()

                  if not svrsBlobStat.success():

                  printError("Unable to get a list of current servers.")

                  return 0


                  svrsList = svrsBlobStat.returnValue.split('\n')

                  return svrsList


                  so, I'm looking for a way to either standardize the case in this sub or make the output from the jli.run to be uppercase when it returns back. Either would work for me. I've tried it a few different ways but usually get an error related to trying to use string conversion methods on a collection.

                  • 6. Re: BLCLI output question

                    There is an upper() method for strings that might work on the returnValue:


                    upperString = svrsBlobStat.returnValue.upper()

                    • 7. Re: BLCLI output question

                      Any yet another way.


                      SERVERLIST=`blcli Server listAllServers`

                      echo $SERVERLIST | tr '[a-z]' '[A-Z]'

                      • 8. Re: BLCLI output question

                        I was hoping for a single way to do it and it seems there are many ways of going about it. I appreciate the suggestions from everyone!