2

How to replace folder path using following command,

sed -i "s/# pidfile: '/var/run/jboss-eap/jboss-eap.pid /# pidfile: '/var/run/jboss-eap/jboss-eap-aa.pid' /g" ks

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

When I use sed -i "s/sample/hi/g" sam.txt It working fine , but above mentioned expression throws unknown exception. How to resolve this error ? have any idea ?

1
  • What is your original text and the text to be replaced? It is not clear this way Commented Mar 14, 2017 at 14:15

1 Answer 1

3

You need to change the delimiter (/) in your statement, as it is also in your pattern.

sed -i "s@# pidfile: '/var/run/jboss-eap/jboss-eap.pid @# pidfile: '/var/run/jboss-eap/jboss-eap-aa.pid' @g" ks

Here I replaced it wiht @, but you can use any delimiter, as long as it's not part of the pattern text.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.