Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sed Error : sed: -e expression #1, char 25: unknown option to `s' [duplicate]

Tags:

sed

I have file .config with line :
projdir name_of_the_projdir
I need to with replace name_of_the_projdir with my own variable. I try to do it with

sed -i 's/^projdir .*$/projdir '$projdir'/' .le/.config

but i get error

sed: -e expression #1, char 25: unknown option to `s'

anyone know what to do ?... i try to replace first ' and last with " and first and alst / with @ . But still not work

like image 383
Jakub Baski Gabčo Avatar asked Oct 05 '22 16:10

Jakub Baski Gabčo


1 Answers

You get that error because the / delimiters you use with the substitute command are clashing with the directory separators. You can change them to something else:

sed -i 's!^projdir .*$!projdir '$projdir'!' .le/.config
like image 199
perreal Avatar answered Oct 10 '22 02:10

perreal