if I have the following lines in a file app.log
some lines here
<AAAA>
abc
<id>123456789</id>
ddd
</AAAA>
some lines here too
<BBBB>
abc
<id>123456789</id>
ddd
</BBBB>
some lines here too
<AAAA>
xyz
<id>987654321</id>
ssss
</AAAA>
some lines here again...
How do I get the particular response that I am interested in by providing the id ?
like if I am interested in AAAA response for id 123456789 like below
<AAAA>
abc
<id>123456789</id>
ddd
</AAAA>
I might need some changes to the command that I am using. it gives me all AAAA responses, but I need to filter the response having the id 123456789
cat app.log | sed -n '/<AAAA/,/<\/AAAA>/p'
Thanks in advance.
Narayana.V