in reply to Replacing duplicate string
Does that make sense?while (<FILE>) { # set modification flag to 0 my $do_mod = 0; if ($do_mod) { # if modification flag is true (>0) # apply substitution if matches s/priority/bandwidth/g; # if line is empty, clear modification flag $do_mod = 0 if (/^$/); } else { # Found first priority, mark modification flag true $do_mod++ if (/priority/); } print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacing duplicate string
by lostjimmy (Chaplain) on Apr 15, 2009 at 19:07 UTC | |
by apok (Acolyte) on Apr 15, 2009 at 19:16 UTC | |
by lostjimmy (Chaplain) on Apr 15, 2009 at 19:24 UTC | |
by apok (Acolyte) on Apr 16, 2009 at 18:33 UTC |