I have unix disk output that I want to convert into an associated array for each line so a user can pick with available disks to use for the next vg creation.
Output of current array item. There is only 1 white space between each column I just did some tab's so it was easier to read.
array(11) {
[0]=> string(141) "vg1 LVM 136G /dev/cciss/c0d0p2 N/A N/A LOCAL N/A N/A NO "
[1]=> string(141) "vg2 LVM 1G /dev/mapper/mpath28p1 60060e80166fa70000016fa700000013 /dev/dm-33 R700 LS1000 0013 YES "
[2]=> string(141) "vg3 LVM 60G /dev/mapper/mpath27p1 60060e80166fa70000016fa700000012 /dev/dm-34 R700 LS1000 0012 YES "
[3]=> string(141) "vg4 LVM 60G /dev/mapper/mpath29p1 60060e80166fa70000016fa700000014 /dev/dm-35 R700 LS1000 0014 NO "
[4]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath21p1 60060e80167220000001722000000048 /dev/dm-37 R700 LS2000 0048 YES "
[5]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath22p1 60060e80167220000001722000000049 /dev/dm-36 R700 LS2000 0049 YES "
[6]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath23p1 60060e80166fa70000016fa70000000e /dev/dm-31 R700 LS1000 000e YES "
[7]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath24p1 60060e80166fa70000016fa70000000f /dev/dm-39 R700 LS1000 000f YES "
[8]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath25p1 60060e80166fa70000016fa700000010 /dev/dm-30 R700 LS1000 0010 YES "
[9]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath26p1 60060e80166fa70000016fa700000011 /dev/dm-32 R700 LS1000 0011 YES "
[10]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath30p1 60060e80167220000001722000000047 /dev/dm-38 R700 LS2000 0047 YES "
I want this to end up something like this. I've been trying different foreach loops but haven't got it to work yet. Any help/suggestions are appreciated.
[0] => name=>vg1 type=>LVM lun_size=>136G mpath_name=>/dev/cciss/c0d0p2 flun_id=>N/A dm_name=>N/A array_type=>LOCAL array_name=>N/A lun_id=>N/A shared=>NO
[1] => name=>vg2 type=>LVM lun_size=>1G mpath_name=>//dev/mapper/mpath28p1 flun_id=>60060e80166fa70000016fa700000013 dm_name=>/dev/dm-33 array_type=>R700 array_name=>LS1000 lun_id=>0013 shared=>NO
[2] => ....etc
Thanks