Replace perl code with a sed script.