How to use the NUL character as a separator in sed substitute and delete commands?
6
votes
7
answers
10387
views
This is what I tried, when intending to replace
/path/to/a
with /path/to/b
using NUL
as the separator/delimiter:
$ cat pathsList| sed -r -e 's\0/path/to/a\0/path/to/b\0g'
sed: -e expression #1, char 27: number option to `s' command may not be zero
**My wanting to go for NUL
:** NUL
and /
are the only characters that are disallowed on ext4fs
, and /
is already used heavily as the pathname separator. Also, I want to avoid quoting and unquoting my data just to be able to used sed
.
If NUL
can't be used as a delimiter (let's say), I'll be okay with any workaround better than quoting and unquoting of my data.
$ sed --version
sed (GNU sed) 4.4
Asked by Harry
(824 rep)
Jul 31, 2018, 03:31 AM
Last activity: Jan 29, 2025, 10:36 AM
Last activity: Jan 29, 2025, 10:36 AM