Start a Conversation

Unsolved

This post is more than 5 years old

D

2603

May 25th, 2014 02:00

Displaying only a part of the symdev output


Hi,

How to display only a part of the symdev output using symcli command ?

SE is installed on a windows machine.

For eg : if I give symdev -sid xxx show  ---> It should display only from this part :

All lines from and below the device external identity :

Device External Identity
    {
    Device WWN           : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Front Director Paths (0): N/A

    Geometry             : Native
        {
        Sectors/Track        :        128
        Tracks/Cylinder      :         15
        Cylinders            :       1150
        512-byte Blocks      :    2208000
        MegaBytes            :       1078
        KiloBytes            :    1104000

How to do this ?

465 Posts

May 25th, 2014 03:00

Windows search command "findstr" might help you.

Run the CLI command and pipe it to findstr. Findstr can match on multiple parmeters using AND or OR.

e.g. symdev list -v | findstr "Sectors Track Blocks Megabytes Kilobytes"

Will display a match on any of the search terms.

If you get a match elsewhere in the output (that you do not want) you can filter them out too with a secondary findstr using the /V option:

e.g. symdev list -v | findstr "Sectors Track Blocks Megabytes Kilobytes" | findstr /V "Stripe"

213 Posts

May 25th, 2014 03:00

Are you using a Windows or a Linux/UNIX SE server?

14 Posts

May 25th, 2014 03:00

symdev -sid 123 show ABC | findstr /c:"Device WWN               :" /c:"Front Director" /c:Geometry /c:"Sectors/" /c:"Tracks/" /c:Cylinders /c:Blocks /c:Megabytes /c:Kilobytes

The above must be a single line on the command prompt. The part with the many spaces between WWN and : (I think 15 spaces) is done to avoid another Device WWN lower down in the 'symdev show' output.

Modify by addiing or removing /c  switches to get exactly what you need for your output though the above is almost identical to your original requirement. You can also add /i switch before the /c entries to make the searches case insensitive.

Hopefully you can construct your Windows query simply enough with the above. You can also use rudimentary regular expressions with findstr (though does not have all the features of grep etc, but it's fairly functional). Hope this helps.

465 Posts

May 25th, 2014 05:00

In this case you can use pattern matching.

All disks are on the C or D loop and this makes up part of the disk name, so a findstr like this will get it:

findstr ":[C-D]"

465 Posts

May 25th, 2014 05:00

If you want to get everything between the brackets, you will need to do it programatically.

setting the output mode to XML may also be useful to you.

30 Posts

May 25th, 2014 05:00

Thank you all for the commands.

I have a query refined on this.

In the symdev output, below is also a part. So if there is no specific field for few lines (ie. refer the spindle, Disk data which has 2 rows in it with 111E and 120E). In this case how to display those 2 rows also. Basically what I am trying to get is under Hyper devices : A flower bracket opens and has some data inside it. How to display these parts ? Something like begin from line no or start from or include etc that we can use to get it ? But these doesnot work on any of the windows SE. Then how to display these portions ?

RAID Group Information

    {

    Mirror Number                            : 1

    RAID Type                                : RAID-1

    Device Position                          : Primary

    Protection Level                         : 2

    RAID Group Service State                 : Normal

    Hyper Devices:

        {

        Device : 332E

            {

            --------------------------------------------------------------

            Spindle   Disk     DA       Hyper      Member        Disk

                     DA :IT   Vol#   Num Cap(MB) Num Status  Grp#  Cap(MB)

            --------------------------------------------------------------

            111E     05C:D5     990   37    1098   1 RW         2   418710

            120E     07C:D5     990   37    1098   2 RW         2   418710

            }

Salem,

SE is installed on Windows server.

114 Posts

May 25th, 2014 12:00

awk is excellent for what you're looking for (You can find awk for windows):

     # prints lines from /beginpat/ to /endpat/, inclusive

awk '/beginpat/,/endpat/'

Here is how to use it in your case (everything between "Device External Identity" and the "}" )

symdev -sid 1402 list  -v  | awk '/Device External Identity/,/\}/'                 

    Device External Identity

        {

        Device WWN           : 60000970000192601402533030303534

        Front Director Paths (2):

            {

            -----------------------------------

             DIRECTOR   PORT             LUN  

            ----------  ---- -------- ---------

            Type Num    Sts  VBUS TID SYMM Host

            -----------------------------------

            FA   07F:0  WD   000  00   000 N/A

            FA   08F:1  WD   000  00   000 N/A

            }

    Device External Identity

        {

        Device WWN           : 60000970000192601402533030303535

        Front Director Paths (2):

            {

            -----------------------------------

             DIRECTOR   PORT             LUN  

            ----------  ---- -------- ---------

            Type Num    Sts  VBUS TID SYMM Host

            -----------------------------------

            FA   08F:0  RW   000  00   022 N/A

            FA   09F:0  RW   000  00   022 N/A

            }

    Device External Identity

        {

        Device WWN           : 60000970000192601402533030303536

Or get the hypers list  from symmdev list -v : (everything between "Hypers" and the "}" )

symdisk -sid XXX  list  -v -gaps -hypers | awk '/Hyper/,/\}/'

  Hypers (8):

  {

  #  Vol  Emulation        Dev  Type          Mir Mbr Status        Cap(MB)

  --- ----- ---------------- ---- ------------- --- --- -------------- --------

    -    - N/A                - GAP            -  -  N/A                  0

    1    1 FBA              2000 RAID-5        1  4  Ready            47101

    2    2 FBA              02DF Data          1  1  Ready            42850

    3    3 FBA              03F6 Data          1  1  Ready            42850

    4    4 FBA              04F1 Data          1  1  Ready            42850

    5    5 FBA              05B2 Data          1  1  Ready            42850

    6    6 FBA              0622 Data          1  1  Ready            42850

    7    7 FBA              0658 Data          1  1  Ready            42850

    -    - N/A                - GAP            -  -  N/A              68298

    8    8 FBA              21C9 RAID-5        1  3  Ready            17335

    -    - N/A                - GAP            -  -  N/A              28879

  }

  Hypers (8):

  {

  #  Vol  Emulation        Dev  Type          Mir Mbr Status        Cap(MB)

  --- ----- ---------------- ---- ------------- --- --- -------------- --------

    -    - N/A                - GAP            -  -  N/A                  0

    1    9 VAULT_DEVICE    0002 Data          1  N/A N/A                5200

    2    10 FBA              200A RAID-5        1  4  Ready            52306

    3    11 FBA              2068 RAID-5        1  4  Ready            52306

    4    12 FBA              02A0 Data          1  1  Ready            42850

    5    13 FBA              03B7 Data          1  1  Ready            42850

    6    14 FBA              04B4 Data          1  1  Ready            42850

    7    15 FBA              0581 Data          1  1  Ready            42850

    -    - N/A                - GAP            -  -  N/A              91956

    8    16 FBA              21F0 RAID-5        1  2  Ready            17335

    -    - N/A                - GAP            -  -  N/A              28209

  }



Google "  10 Awk Tips, Tricks and Pitfalls - good coders code, great reuse "  to find some excellent awk examples

No Events found!

Top