I am trying to look for a text block, and put some of the lines in a dictionary array. So a dictionary for every text block I find. for example the following text:
some
other
text
address-object object1
name "name1"
uuid 4ac9cf52-02b5-eecf-0100-18c24100da5e
zone zone1
host ip1
exit
address-object object2
name "name2"
uuid a5c02150-a47e-748d-0100-18c24100da5e
zone zone2
host ip2
exit
some
more text
I would for example would like to store ip, and zone in the array for each block so I would end up with [[host:ip1,zone:zone1],[host:ip2,zone:zone2]].
I have tried to loop through the text file but cannot get the looping through the block correct. I think I have to use some form of iteration but I am not sure. I end up with a single array with all the items from the first address-object line until the some keyword. I need a loop for each address-object and got the next when I encounter an empty line.
And the result: