Skip to content
Advertisement

How Do I Fix This SED Command to Find & Replace a String

Good-day,

I’m working on a Bash script for Debian Jessie and in this line;

JavaScript

I am trying to find base_dir}/scripts and replace it with script_dir} so that my new line will read as:

JavaScript

This is what I have tried so far;

JavaScript

which results in this error;

JavaScript

I am confused as to how to resolve this and would appreciate some assistance please, thanks.

Advertisement

Answer

You can use this sed with an alternate delimiter to avoid escaping /:

JavaScript

You don’t need -r here (needed for extended regex)

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement