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 cyberciti.biz/faq/how-to-use-s for more info. #linux #unix #macos #freebsd #opensource

Follow

@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

Sign in to participate in the conversation
Librem Social

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)

image/svg+xml Librem Chat image/svg+xml