Okay..
The system command hdparm outputs
a "," delimited paragraph of plain text.
Sample line:
MaxMultSect=16, DMA=yes, ATA=ATA1 ATA2 ATA3
There are 8 or 9 of these lines,all similar.
With my sort , depending on whether or not
certain regexps were matched I would get one OR the other pattern matches:
example:
split($0, arr, ","

for (x in arr)
if (arr[x] ~ /BuffSize/) {
mode[buff] = arr[x]
}
this would return BufferSize=2048, as
expected.
However if I included THIS pattern afterwards
for (j in arr)
if (arr[j] ~ /MaxMult/) {
mode[sect] = arr[j]
)
only one or the other would return a value.
There were multiple for loops in my solution,
indexing patterns and building the array.
Then when printing all the array vars:
for (i in mode)
print mode
I would get either MaxMult=16 OR
BufferSize=2048, depending on which was
sorted first These patterns were located on the same line of the paragraph, but were separated by a comma. All the other patterns returned predictable results=all matches of the pattern in the array var. I also tried earlier with nested ifs, which did not work well at all, which was the reason for my original inquiry.
Even though I reported the problem fixed it
recurred when I tried mixing and matching these two patterns again.
I hope this tells you what was going on.
I am having better results with an expect script right now on this problem but am still
interested in a solution for the other half
finished awk/shell script.
Thank You.
MD