I 've got a file named file.conf containing:
this is the configuration text and this is the WORD to change.
Running:
sed -i 's/WORD/"ONE TWO"/g' file.conf
I will have file.conf modified:
this is the configuration text and this is the "ONE TWO" to change.
now if I make a script, using read:
read -p 'word to change' TEXT -> "ONE TWO"
echo $TEXT -> "ONE TWO"
sed -i 's/WORD/'$TEXT'/g' file.conf
it does not work with error message:
sed: -e expression #1, char 11: unterminated `s' command
file.conf is not modified in this case.
but it works if I read $TEXT with only one word without spaces: "ONE" for instance.
Thanx folks.