so this is what i want to do. i have data that looks like this:
DATA:
Array: A
Interface Type: SAS
Unused Space: 0 MB
Status: Failed
Logical Drive: 2
Size: 279.4 GB
Fault Tolerance: RAID 1
Heads: 255
Sectors Per Track: 32
Cylinders: 65535
Stripe Size: 128 KB
Status: Interim Recovery Mode
Array Accelerator: Enabled
Unique Identifier: afafafaf
Disk Name: /dev/cciss/c0d1
Mount Points: None
Logical Drive Label: faffafaf
Mirror Group 0:
physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
Mirror Group 1:
physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, Failed)
physicaldrive 1I:1:3
Port: 1I
Box: 1
Bay: 3
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 300 GB
Rotational Speed: 10000
Firmware Revision: HPDC
Serial Number: fafafafa
Model: HP fafafaf
PHY Count: 2
PHY Transfer Rate: Unknown, Unknown
physicaldrive 1I:1:4
Array: B
Interface Type: SAS
Unused Space: 0 MB
Status: Failed
Logical Drive: 2
Size: 279.4 GB
Fault Tolerance: RAID 1
Heads: 255
Sectors Per Track: 32
Cylinders: 65535
Stripe Size: 128 KB
Status: Interim Recovery Mode
Array Accelerator: Enabled
Unique Identifier:
Disk Name: /dev/cciss/c0d1
Mount Points: None
Logical Drive Label:
Mirror Group 0:
physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
Mirror Group 1:
physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, Failed)
physicaldrive 1I:1:3
Port: 1I
Box: 1
Bay: 3
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 300 GB
Rotational Speed: 10000
Firmware Revision: HPDC
Serial Number:
Model: HP
PHY Count: 2
PHY Transfer Rate: Unknown, Unknown
physicaldrive 1I:1:4
The actual data is of course much bigger than this. But the above is the layout. What i want to do is grab certain values under each Array.
So for Array B, say i want to grab the value of "Sectors Per Track", how do i do so? in this case, i'd like an output similar to: ArrayB=(Sectors Per Track,32).
My first instinct is to run a while loop on the command that produces the data. but i'm not sure of how to make the while loop smart enough to know when each Array begins and when it ends.
I'm hoping awk can be used here.
The ultimate goal here is to be able to grep for certain things under each array and be able to tie thing being grepped for back to the array, as i bolded above.
Another example, for Array A, see if there are any strings that contain the word "Fail". If there are, output the lines. ex. ArrayA=(physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, Failed)
OS: Linux/SunOS
Bash