in reply to delete above matching line?
Your while-loop reads line by line, so you can never match the previous line in a regex.
I gets much easier if you read the whole file into a string, and then apply a substitution.
I don't know what output you expect, but this might do you want:
s/^\s*start_of_block\s*\{.*?\};\s*//xmsg;
If not, please tell us exactly what output you want.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: delete above matching line?
by oldmanwillow (Novice) on Jul 01, 2010 at 07:56 UTC | |
by happy.barney (Friar) on Jul 01, 2010 at 08:19 UTC | |
by oldmanwillow (Novice) on Jul 01, 2010 at 16:34 UTC |