I have a little problem.
I try to replace a string(well a line) by a $variable in a file.
So I use the command :
sed -i -e "s/conf .*/conf = $PATH_CONF/g" generals.conf
If PATH_CONF does not contains specials characters like "/", it's working.
But PATH_CONF contains a path(/home/etc.) so it has several "/", then I got an error :
bad flag in substitute command: 'h'
So how must I do to have specials characters in my $variable ?
thanks.
Try:
sed -i -e "s@conf .*@conf = $PATH_CONF@g" generals.conf
You need the identical chars as separators (here @), not three /s necessarily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With