I want to insert a word at the beginning of a line specified with line number, using sed. This oneliner works:
line="this is my line"; newfile=`sed "6s/.*/word $line/" /opt/file.txt`
But my issue is that when i run the code in a script it throws an error:
line="this is my line"
newfile=`sed "6s/.*/word $line/" $FILE_PATH`
sed: -e expression #1, char 91: unknown option to `s'
Sed version: GNU sed version 4.1.5