in reply to Replacing a substring from a string in a file
I might slightly rewrite as follows:
open my $in, '<', 'abc.xml' or die "Can't read abc.xml: $!"; open my $out, '>', 'iabc.xml' or die "Can't write iabc.xml: $!"; while ( my $line = <$in> ) { $line =~ s/\\limits//g; print $out $line; } close $in or die "close input: $!"; close $out or die "close output: $!";
I note that the string you say you're looking for ("\limits") is not in the example string you give ("$ a+b=\sum\limit_a^{n-j}$"). I also note that the example string appears to be TeX, so a non-Perl solution might be to redefine the macro.
|
|---|