Perl is supposed to make easy things easy and in place file editing should be easy shouldn't it? Consider:
use strict; use warnings; my $cell_name = 'xyzzy'; my $match = 'STARTING_PATTERN'; @ARGV = 'delme.txt'; $^I = '.bak'; while (<>) { s/$1/$cell_name/ if /$match\s+(.*)/; print; }
Yup, that looks easy.
In reply to Re^2: Trying to substitute a variable with another variable in a string but not working
by GrandFather
in thread Trying to substitute a variable with another variable in a string but not working
by kaushik9918
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |