EMBED THIS RECORDING:
<div><script id="playterm-MjAxMi0wMi9wYXRjaGh0bWx0dHlyZWMtMTMyOTg1NjAwOHw4MHgyNA==" type="text/javascript" src="https://playterm.org/js/?hash=MjAxMi0wMi9wYXRjaGh0bWx0dHlyZWMtMTMyOTg1NjAwOHw4MHgyNA==" class="size:80x24"></script></div>
I recorded this `poor man's text patcher` shellsession because I was trying to find a way easily
edit/read patchfiles for generated html.
This is a simplified example of the patchsystem I wrote. Commands used:
sed -i "s/searchterm/replacement/g" somefile.html
m4 patch.m4
varname=$(cat foo.html)
ps. don't forget to use ` and ' for m4 strings (not '' or "")
Mike said
Wut!??
's/REPLACE/target'
You do not need to escape target that much. Just escape the backslashes - sed accepts POSIX2
regexes, and in POSIX2 regexes the characters have a special meaning only when preceded by a
backslash.
coderofsalvation said
coderofsalvation said
btw. I also noticed sed also excepts '|' as delimiter.
This is really handing when inserting urls without escaping like:
's|%url%|http://playterm.org/flop/flap'