how to replace commented line with sed

I want to replace below line with sed so I am trying below command which is giving me error "sed: -e expression #1, char 59: unknown option to `s'"

I have not known to sed much can you guys help what I am missing in below command

sed -i 's/"\#trusted_proxies = "/"trusted_proxies = 172.16.0.0/12, 172.17.0.0/12, 172.18.0.0/12, 172.19.0.0/12 "/g' runup.sh

it is giving "sed: -e expression #1, char 59: unknown option to `s'" error.

Regards, SAMURAI

1 Answer

It's because you have / characters in your replacement text and you're also using / as your sed delimiter. Try using a different character as your sed delimiter, like ::

sed -i 's:"\#trusted_proxies = ":"trusted_proxies = 172.16.0.0/12, 172.17.0.0/12, 172.18.0.0/12, 172.19.0.0/12 ":g' runup.sh

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like