0

I need to replace the string '../lib' to '/usr/share/server/bootstrap/lib' in a file bootstrap.sh

I used the following sed expression

sed -i -e 's//././/lib///user//share//server//bootstrap//lib/g' bootstrap.sh

It fails with the log

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

Unable to identity the mistake in the expression.Kindly help.

Priyanka.Patil
  • 1,177
  • 2
  • 15
  • 34

1 Answers1

1

You need to escape every . and /

sed -i -e "s/\.\.\/lib/\/usr\/share\/server\/bootstrap\/lib/" bootstrap.sh

Alternative way to avoid two many backslashes using # as delimiter instead of /.

Thanks sp asic

sed -i "s#../libs#/usr/share/server/bootstrap/lib#" bootstrap.sh
Community
  • 1
  • 1
sozkul
  • 665
  • 4
  • 10