Subject: bug#19842: sed bug: using -e instead of a literal newline in s replacement fails

From: Evan Gates <[email-masked]>
Date: Tue, 17 Feb 2015 16:23:54 -0800

On Tue, Feb 17, 2015 at 3:48 PM, Norihiro Tanaka <[email-masked]> wrote:
> Hi,
>
> I interprete following as multiple `-e' option does not merge fragments
> of two commands.
>
>   # If any -e or -f options are specified, the script of editing commands
>   # shall initially be empty.
>
> i.e. the command by first -e option is parsed without the completion,
> the buffer is initialized into empty before next -e option.
>
> Thanks,
> Norihiro
>

Hi Norihiro,

Thanks for replying. I respectfully disagree with your interpretation.

The -e and -f options talk about "the script of editing commands" as
the entire script/program that will run once sed starts reading input.
Both -e and -f add commands to "the end of the script of editing
commands." The line you quoted uses the exact same phrase:

1) -e  script
Add the editing commands specified by the script option-argument to
the end of the script of editing commands.
2) -f  script_file
Add the editing commands in the file script_file to the end of the
script of editing commands.
3) If any -e or -f options are specified, the script of editing
commands shall initially be empty.

I posit that "the script of editing commands" means the same thing in
all three places. Therefore (3) means that the script/program that sed
will run is empty before the first -e or -f.

Your interpretation would cause "the script of editing commands" to
mean something different in (3) than it means in (1) and (2).

Thank you,
Evan