I realise sed can pattern match over multiple lines. Is it possible to replace a word within a certain section of these multiple lines? E.g.
file begins
random line
>>starting line block
random line
random line
.....
>>replace from here
hello
hi there hello
>>stop replacing here
more random stuff
>>finishing line block
more random lines
file ends
Suppose I want to replace 'hello' with 'bye' but only between 'replace from here' to 'stop replacing here' and also only in between 'starting line block' to 'finishing line block'. Is it possible to do that in place using sed? e.g.
sed '/starting line block/,/finishing line block/ /replace from here/,/stop replacing here/ s/hello/bye/g/'