Description
A block begins with a line of the form # begin
and ends with a line of the form # end.
We want to replace every block containing `this' with the following lines:
HAS BEEN
MODIFIED
|
| Raw Input
|
| Desired Output
| line 1
line 2
# begin
replace this
block
# end
line 7
line 8
# begin
keep the
block
# end
line 13
|
| line 1
line 2
# begin
HAS BEEN
MODIFIED
# end
line 7
line 8
# begin
keep the
block
# end
line 13
|
|
Script and Comments
Script1 [ 1] /^# begin$/!b
[ 2] :loop
[ 3] N
[ 4] /\n# end$/!b loop
[ 5] /this/s/\n.*\n/\n HAS BEEN \n MODIFIED \n/
| |
|