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; }
In reply to Re: Replacing duplicate string
by apok
in thread Replacing duplicate string
by ddrew78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |