how to replace two things at once with sed?

sed, shell

Solution

The following sed example should solve your problem. sed allows multiple -e switches, which allows you to replace more than one thing at a time.

sed -e 's/dog/monkey/g' -e 's/orange/cow/g'

Problem

Given is string: `dog apple orange banana` I need to make it: `monkey apple cow banana` That is without calling sed twice.

Original source