This code at least works, even if it isn't as pretty as it could be.$^I = ".bak"; @ARGV = "inplace.txt"; my $flag, my @arr; while(<>) { if (!$flag && /^\s*Tag {/) { $flag = 1; } elsif ($flag) { if (/^\s*}/) { $flag = 0; } elsif (/^\s*Name/) { (@arr) = split(/"/, $_, 3); @arr[1] =~ s/\s//g; $_ = join('"', @arr); $flag = 0; } } print; }
In reply to Re: In-place editing of files
by TedPride
in thread In-place editing of files
by richz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |