GNU bug report logs -
#32765
Bug when changing and adding line
Previous Next
Reported by: Mohamed Akram <mohd.akram <at> outlook.com>
Date: Tue, 18 Sep 2018 21:57:02 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 6 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.