The situation is next. I got log file where logs separated with minus chars like:
Timestamp1
---
Log: 1
Address: http://addr1.com
Payload: <soap:Envelope>
<soap:Body>
<context 1-1>
<context 1-2>
<context 1-3>
</soap:Body>
<soap:Envelope>
---;
Timestamp2
---
Log: 2
Address: http://addr2.com
Payload: <soap:Envelope>
<soap:Body>
<context 2-1>
</soap:Body>
<soap:Envelope>
---;
Timestamp3
---
Log: 3
Address: http://addr3.com
Payload: <soap:Envelope>
<soap:Body>
<context 3-1>
<context 3-2>
</soap:Body>
<soap:Envelope>
---;
...
I need to get whole log info where some keyword found e.g. if keyword is "context 2-1" next strings should be printed:
---
Log: 2
Address: http://addr2.com
Payload: <soap:Envelope>
<soap:Body>
<context 2-1>
</soap:Body>
<soap:Envelope>
---;
So how can i do this pattern search with "greedy" cut of delimeters around it?