Perl
perl -pi.bak -e '$from='\''fixed string'\''; $to='\''replacement string'\''; s/\Q$from\E/$to/g' <file>
# or
perl -s -pi.bak -e 's/\Q$from\E/$to/g' -- -from='fixed string' -to='replacement string' files/mini_snmpd.init
perldoc perlrun
says that with -s
, Perl does rudimentary switch parsing for switches before an argument of --
or any filename arguments like files/mini_snmpd.init
. But in practice, you have to add --
before the from
and to
arguments in this case.