[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32765: Bug when changing and adding line
From: |
Assaf Gordon |
Subject: |
bug#32765: Bug when changing and adding line |
Date: |
Tue, 18 Sep 2018 16:16:03 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
tag 32765 notabug
close 32765
thanks
Hello,
On 18/09/18 03:55 PM, Mohamed Akram wrote:
Given the following command:
echo foo | sed '{
c\
bar
a\
baz
}'
GNU sed 4.4 prints:
bar
Expected (and on macOS):
bar
baz
I think (based on reading the POSIX spec) that GNU sed
is actually correct, while MacOS's sed is wrong.
The POSIX standard says about the "c" command:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03
[2addr]c\
text
Delete the pattern space. With a 0 or 1 address or at the end of a
2-address range, place text on the output and start the next cycle.
That is - after executing the "c" command (and outputting "bar"),
sed should "start the next cycle" - meaning skip all other commands.
I'm thus marking this as "not a bug",
but discussion can continue by replying to this thread.
regards,
- assaf