1+/friend/;/lover/g/Madonna/+2s/singer/singer,actress/
The preceding command changes "singer" to "singer,actress" on the 2nd line
below any line containing the word "Madonna", but only within the range defined
by the first occurrence of a line containing "friend" and the next (after
that line) occurrence of a line containing the word "lover".
You might actually use something like this to edit one of those semi-freeform
hierarchical data files where lines under a header describe, sequentially,
properties of that header.
Aren't you glad you asked? Me -- I program in Pascal and Perl -- so I think
I'd find a more readable way to accomplish the same thing.
Click your browser's "back button" to return to the December 2002 Linux Productivity Magazine.