I want to replace multiples phrases in a file using sed -e. The problem is that I want to replace certain phrases with a string is there anyway to do this? Because when I do this using
sed -e 's/foo/$bar/' -e 's/some/$text/' file.whatever
then it does not have any effect…
When you say with a string I believe you mean with a variable. If that is the case, simply surround the
sedcommand with double-quotes instead of single-quotes. The former will allow for variable expansion, the latter will not.