You could use Perl, which offers the -i option in all versions since way back. Its syntax is basically identical to sed syntax as far as the s/// substitution operator is concerned. There's a s2p script for converting nontrivial sed scripts, but for this one, just use if (1..1) instead of the plain 1.