Did you know? The / is the default delimiter in sed, but it can be any character other than a backslash (/) or newline (\n) can be used instead of a slash (/) to delimit the regex and the replacement. See https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/ for more info. #linux #unix #macos #freebsd #opensource
@nixCraft
And use double-quotes if you need to allow variable expansion.
Example:
sed -i "s|old str ${FOO}|new str ${BAR}|g" input.txt
Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy. Stay safe. Please abide by our code of conduct. (Source code)