Sed. How change line next to specific pattern

Posted by kirill on Stack Overflow See other posts from Stack Overflow or by kirill
Published on 2011-12-01T05:15:10Z Indexed on 2011/12/01 9:51 UTC
Read the original article Hit count: 190

Filed under:
|

My file is:

DIVIDER  
Sometext_string

many  
lines  
of random  
text  
DIVIDER  
Another_Sometext_string  
many  
many  
lines  
DIVIDER  
Third_sometext_string  
....

How change lines following DIVIDER pattern

Result must be:

DIVIDER  
[begin]Sometext_string[end]

many 
lines  
of random  
text  
DIVIDER  
[begin]Another_Sometext_string[end]

many  
many  
lines  
DIVIDER  
[begin]Third_sometext_string[end]

....

© Stack Overflow or respective owner

Related posts about bash

Related posts about sed