sed: Can not handle patterns with `nul`

The version of sed supplied with MacOS is not able to handle patterns using the nul character:

printf "Before ->\0<- After" | sed "s/.*\0/ _REMOVED_ /"
# Before -><NUL><- After

GNU sed also fails to process those patterns (but has the -z option that treats them as line terminators):

printf "Before ->\0<- After" | gsed "s/.*\0/ _REMOVED_ /"
# Before -><NUL><- After

Workaround: Translate nul to something else

Luckily tr will happily translate nul to something else, which allows us to switch in/out of a format that sed can process:

printf "Before ->\0<- After" | tr "\0" "¶" | gsed "s/¶/ _REMOVED_ /"
Before -> _REMOVED_ <- After
Published on: 20 Aug 2023