There is a server log page - this type:
<html> <head></head> <titile></title> <body> <table> <tr></tr> <tr></tr> <tr></tr> </table> #Много таких блоков <table> <tr></tr> <tr></tr> <tr></tr> </table>
It is quite normal to do this kind of constellation.
cat index.html | grep "Нужное событие:" -A 4 -B 21
Which was looking for the right combination of words and showed 4 lines below - it was the beginning of the "table" block and, accordingly, 21 lines above, where the beginning of the table block was.
Everything was fine, but there were some changes, and the number of tr-tr lines began to change, then more, then less.
And accordingly, and so it would be good to do at the very beginning, put the search / output between the table-table blocks
But I don’t understand how to implement bash ... grep didn't give me hints, but with sed I can only replace the block between the lines, but I don’t see how I can point it out ...
Tell me. Thank.