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 ?

Shankar
  • 311
  • 4
  • 20

1 Answers1

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.

Jesse Bakker
  • 2,403
  • 13
  • 25