I have a file with the following info:
start pattern1
line1
line2
...
end pattern1
line3
line4
start pattern2
...
my output should be:
start pattern1
line1
line2
end pattern1
If I know what pattern1 is , I can do
sed '/start pattern1/,/end pattern1/p' <file>
but here, I want to match pattern1 (like \S+ in perl regex) and use the same (like $1) in the end. How can I do that?