i have a text file containing some content like that,
some content replace content other content
and i have some variables, looking like this:
PATH="/path/to/scriptdir" PARAMETERS="para1 para2" FILETOCHANGE="/foo/bar"
Now i want to replace the content in the text file that begins with replace, with the content of the variables PATH and PARAMETERS. The text file should look like that, after the replace:
some content /path/to/scriptdir/script para1 para2 other content
I just tried the a couple of sed commands, but always i get an error. For example
sed -i "s/^replace.*$/$PATH/script $PARAMETERS/g" $FILETOCHANGE sed: -e expression #1, char 12: unknown option to `s'
sed -i "s|^replace.*$|$PATH/script $PARAMETERS|g" $FILETOCHANGE sed: -e expression #1, char 58: unterminated `s' command
Can you tell me, what I'm doing wrong?