2009/5/22

How to put variable in sed command

I declare a variable in bash

VALUE=dance

How to put it in sed command like that:

sed 's/hop/$VALUE/' filename

Solution:

sed 's/hop/'"$VALUE"'/' filename

OR

sed 's/hop/'$VALUE'/' filename

Two method are worked.