Re: Null character in replacement

Zachary Vance <[email protected]> Fri, 24 Oct 2014 21:02:23 -0700
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <CAC8+__7kNg7rCJhoTBWZgmMY0C0FUF4+hUG-Mn8mFTmzEJUbVw@mail.gmail.com>
Andreas: That's extremely helpful to learn. Thanks.

On 24 October 2014 06:13, Andreas Schwab <[email protected]> wrote:

> Zachary Vance <[email protected]> writes:
>
> > sed -e "s/^$/\0/" (in bash, an s// expression containing a literal zero
> > byte) performs no replacements on the stream.
>
> A command line argument cannot contain a literal zero byte, since
> argument strings are zero-terminated, and you would get an error about
> an unterminated command.
>
> $ sed -e $'s/^$/\0/'
> sed: -e expression #1, char 5: unterminated `s' command
>
> Andreas.
>
> --
> Andreas Schwab, [email protected]
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>