Using variables in sed commands

Hi there, I need to be able to put the hostid of my box into a file (replacing the text "enter_hostid_here" so i tried

sed -e 's/enter_hostid_here/`hostid`/g' inputfile > outputfile

but it takes the `hostid` literally as text .....how can I get this info into the file (ideally in a single line)

I notice also that you cant call $VARIABLES in sed statements either as they too are taken literally

any help would be great
Cheers

hostid="12.23.12.1"
sed -e "s/enter_hostid_here/$hostid/g" inputfile > outputfile
1 Like

thank you it works