Venerated Monks,

I want to count the size and type of devices in my Storage Array. Here is how the output looks:

00C0 Not Visible ???:? 16D:D5 2-Way Mir N/Grp'd R +W 3 00C1 Not Visible ???:? 01A:D5 2-Way Mir N/Grp'd R +W 3 00C2 Not Visible ???:? 16B:D5 2-Way Mir N/Grp'd R +W 3 01D1 Not Visible ???:? 01D:D0 RAID-5 N/Grp'd R +W 8632 01D2 Not Visible ???:? 16D:D1 RAID-5 N/Grp'd R +W 8632 059B Not Visible ???:? 02D:D7 RAID-5 N/Grp'd (M) R +W 34526 0A77 Not Visible ???:? 02C:CB 2-Way Mir N/Grp'd (M) R +W 34526 0A7B Not Visible ???:? 02C:C9 2-Way Mir N/Grp'd (M) R +W 34526 0A7F Not Visible ???:? 02C:CD 2-Way Mir N/Grp'd (M) R +W 69052 0A83 Not Visible ???:? 02C:C5 RAID-5 N/Grp'd (M) R +W 34526 0A87 Not Visible ???:? 02C:C7 RAID-5 N/Grp'd (M) R +W 34526 0A8B Not Visible ???:? 01C:DB RAID-5 N/Grp'd (M) R +W 69052 0A8F Not Visible ???:? 01C:DD RAID-5 N/Grp'd (M) R +W 69052 0DB3 Not Visible ???:? 16D:C12 BCV+R5 N/Grp'd (M) R +W 34526 0DB7 Not Visible ???:? 16D:C16 BCV+R5 N/Grp'd (M) R +W 34526

I need the output so that it tells me something like:

Total Number of 2-Way Mir Devices of 3MB = 3 Total Number of 2-Way Mir Devices of 34GB = 3 Total Number of 2-Way Mir Devices of 69GB = 1 ============================================== Total Number of RAID-5 Devices of 34GB = 4 Total Number of RAID-5 Devices of 8.6GB = 2 Total Number of RAID-5 Devices of 69GB = 2 ============================================= Total Number of BCV+R5 Devices of 34 GB = 2

====================

Update:

The output shown above is obtained by running command:

symdev -sid 1234 list -noport -noreserve|find /I "not visible"

So am trying to figure out how to pass the output of this command to a Filehandle so that I can try out stuff given in the node 504596. Is that a good way to go about it?

====================

Now, thing is, in this output, there are 3 things that will vary.

1) The Type of RAID (2 Way Mir, or RAID5, Or BCV+R5, or something else).

2) The Size of Devices: This too will vary and could be different from the sizes given above.

3) the count of such type of devices.

I tried using split function, but I can get it to split on a line or a white space. Once I hold the split items in an array, I cant further split it, because the split function works in a scalar context.

Then I thought of using a hash, but from what I know, a hash can only have one value associated with a key. Is there a way to have multiple values associated with a hash key? I was planning to use 504596 as a reference to do it. Would that be the right way to go about this? Would redirecting the command output to a text file using a filehandle and then reading from it give me any advantages? I browsed through some articles, but nothing seems to make things clear for me.

I am not asking for a ready made code for this, as that will refute the very purpose of me trying to learn Perl. But I would kindly request me to guide to some pointers that will help me do it. Please help.

Perlpetually Indebted To PerlMonks


In reply to Counting devices types, device sizes and number of devices. by perl514

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.