insertion of text from sed script

Hi ,

This is my first thread ; facing some issues withmy sed script

I need to insert the code from my log file which is between two keywords.

content is like this ........
log
############################

log1 log2
231 "Ban" "tom" and the line one of the cross line
friend samsung and the "unit" lite three two four
log3 log4

I used this sed script

sed -n '/log1 log2/,/log3 log4/p' log > file1

It is printing the whole content including log1 log2 and log3 log4 which I dont want in the file1

Please give me some advice in this regards

Shalini

not an elegant way, here is a try

awk '{ if ( $0 ~ /log1 log2/ ) { set=1; next }; if ( $0 ~ /log3 log4/ ) { set = 0 }; if ( set ) { print } }' sample

Try this

awk ' /log1 log2/,/log3 log4/ ' log > file1

or here is another code

awk '/log1 log2/,/log3 log4/ {gsub(/log1 log2/, log3 log4); print}' log > file1

or here is another code

awk '/log1 log2/,/log3 log4/ {gsub(/log1 log2/, log3 log4); print}' log > file1