I have a log file and I need to extract the sections related to a specific event. I performed something similar before but easier with the "sed" command.
The task I've been trying to solve is the following. I need to extract all the portions of text in the file starting with the word "BEGIN" included and ending before the next "BEGIN" where it is included a specific word identifying a table in my database. I need help with the usage of the sed command.
The task can be summarized in "search between all occurrences delimited by Start and End containing the word word"
The text looks like something like this:
BEGIN
...
something here
something here containing the desired "word"
something here
...
COMMIT
BEGIN
.
.
.
COMMIT
BEGIN
And I want to obtain all the occurrencies conaining "word" as this:
BEGIN
...
something here containing the desired "word"
...
COMMIT