Extracting multiple lines of data between two delimiters

Viewed 308

I have a log file containing multiple lines of data. I need to extract and the all the lines between the delimiters and save it to the output file

input.log

Some data 
<delim_begin>ABC<delim_end>
some data
<delim_begin>DEF<delim_end>
some data

The output.log file should look like

ABC

DEF

I tried this code but it does not work, it prints all the content of input.log

sed 's/<delim_begin>\(.*\)<delim_end>/\1/g' input.log > output.log
4 Answers
Related