Description
A block begins with a line of the form section N begin
and ends with a line of the form section N end
where N is a number.
We want to get every block containing `this'.
|
| Raw Input
|
| Desired Output
| .....
section 1 start
line 1-1
section 1 end
....
section 2 start
line 2-1
line 2-2 this!
section 2 end
....
....
section 3 start
line 3-1 this!
section 3 end
....
section 4 start
section 4 end
....
|
| section 2 start
line 2-1
line 2-2 this!
section 2 end
section 3 start
line 3-1 this!
section 3 end
|
|
Script and Comments
Script1 [ 1] /^section [0-9][0-9]* start$/!d
[ 2] :loop
[ 3] N
[ 4] /\nsection [0-9][0-9]* end$/!b loop
[ 5] /this/!d
| |
|