I have an xml-like textfile which I would like to parse into an array. The input file looks like this
<AA>
<BB>content 1</BB>
</AA>
<AA>
<BB>content 2</BB>
</AA>
I want the output to be like (meaning one whole AA-block per array element):
ARRAY[0]=<AA><BB>content 1</BB></AA>
ARRAY[1]=<AA><BB>content 2</BB></AA>
I tried
ARRAY=(`cat input.txt | grep -A 3 \<AA\>`)
but this only returns me one line per array element. Does anyone have an idea?