Use double quotes for the sed
expression.
new_db_name=$(echo "$new_db_name" | sed "s/$replace_string/$replace_with/")
More Related Contents:
- Is it possible to replace a newline AND another character with a single tab using sed?
- How can I replace each newline (\n) with a space using sed?
- Using different delimiters in sed commands and range addresses
- How to insert strings containing slashes with sed? [duplicate]
- sed fails with “unknown option to `s'” error [closed]
- Combining two sed commands
- How to escape single quote in sed?
- Using different delimiters in sed commands and range addresses
- Remove non-ASCII characters from CSV
- Remove multi-line comments
- Insert a line at specific line number with sed or awk
- How to remove trailing whitespaces with sed?
- How to replace the nth occurrence of a string using sed
- Change multiple files
- Remove line if field is duplicate
- delete a column with awk or sed
- Add text at the end of each line
- remove ^M characters from file using sed
- How to use awk to print lines where a field matches a specific string?
- What is the difference between sed and awk? [closed]
- Remove all lines before a match with sed
- sed: Replace part of a line
- Print lines in file from the match line until end of file
- sed gives me “: unexpected EOF (pending }’s) error and I have no idea why
- Have sed ignore non-matching lines
- sed delete lines not containing specific string
- sed + remove “#” and empty lines with one sed command
- Delete specific line number(s) from a text file using sed?
- Remove Unicode characters from textfiles – sed , other Bash/shell methods
- How to replace an entire line in a text file by line number