Hi,
I'm looking for a command to retrieve a block of lines using
sed or grep, probably awk if that can do the job.
In below example,
By searching for words "
Third line2" i'm expecting to retrieve the full block starting with '
BEGIN' and ending with '
END' of the search.
Example:
BEGIN
Second line
Third line1
Fourth line
END
BEGIN
Second line
Third line2
Fourth line
END
BEGIN
Second line
Third line3
Fourth line
END
Output Expecting:
BEGIN
Second line
Third line2
Fourth line
END
Note: Block line size can vary & each block can have different line sizes from one other.
Thank you