Sed Error: sed: -e expression # 1, char 25: unknown parameter `s'

I have a .config file with the line:
projdir name_of_the_projdir
I need to replace name_of_the_projdir with my variable. I am trying to do this with

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

but i get an error

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

Does anyone know what to do? ... I am trying to replace first and last, and first, and alst / s @. But still not working

+4
source share
1 answer

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

 sed -i 's!^projdir .*$!projdir '$projdir'!' .le/.config 
+4
source

All Articles