mikejones has asked for the wisdom of the Perl Monks concerning the following question:
Output: HoH
Problem: system command with lots of garbage output.
Goal: To create a HoH with SAN_VC0_## as the key and the hdisk string plus its serial as the values.
All I need is a single hdisk# string from the below system command output. Thank you! Here is what I have tried:
Output of system command:use strict; for my $lun ( ('SAN_VC0_42','SAN_VC0_43') ) { $luns_to_hdisk {$lun} = { grep /hdisk\d+/, qx(vxdisk list $lun) } ; } print Dumper(\%luns_to_hdisk); $VAR1 = { 'SAN_VC0_43' => { 'hdisk855 state=enabled ' => 'hdisk920 state=enabled ', 'hdisk587 state=enabled ' => 'hdisk652 state=enabled ', 'hdisk51 state=enabled ' => 'hdisk116 state=enabled ', 'hdisk319 state=enabled ' => 'hdisk384 state=enabled ' }, 'SAN_VC0_42' => { 'hdisk571 state=enabled ' => 'hdisk636 state=enabled ', 'hdisk35 state=enabled ' => 'hdisk100 state=enabled ', 'hdisk303 state=enabled ' => 'hdisk368 state=enabled ', 'hdisk839 state=enabled ' => 'hdisk904 state=enabled ' } };
$ vxdisk list SAN_VC0_42 Device: SAN_VC0_42 devicetag: SAN_VC0_42 type: auto info: format=none flags: online ready private autoconfig invalid pubpaths: block=/dev/vx/dmp/SAN_VC0_42 char=/dev/vx/rdmp/SAN_VC0_42 Multipathing information: numpaths: 8 hdisk35 state=enabled hdisk100 state=enabled hdisk303 state=enabled hdisk368 state=enabled hdisk571 state=enabled hdisk636 state=enabled hdisk839 state=enabled hdisk904 state=enabled
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: trying HoH
by gone2015 (Deacon) on Nov 11, 2008 at 01:47 UTC | |
|
Re: trying HoH
by toolic (Bishop) on Nov 11, 2008 at 02:06 UTC | |
by mikejones (Scribe) on Nov 11, 2008 at 02:27 UTC | |
|
Re: trying HoH
by kyle (Abbot) on Nov 11, 2008 at 01:53 UTC |