I'm working on a script to process the output of a configuration file in a way that it results in valuable data.
The output is in the format:
[header]
attribute1 = integer
attribute2 = integer
[header]
attribute1 = integer
attribute2 = integer
...
Where there can be an unknown amount of stanzas with the same two attributes (with unknown integer values), but with different headers.
So far I have only been able to generate the number of different stanzas to use it as a loop counter, but I am not sure how to loop through the output, leave the header unchanged but sum the integer value of the two attributes and replace these with a new attribute with the sum such as,
[header]
new_attribute = integer
[header]
new_attribute = integer
I have looked into the command read
but I am not sure how to generate the report I want with it.