|Anonymous | Login||2023-12-05 19:26 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details|
|ID||Category||Severity||Type||Date Submitted||Last Update|
|0001767||[1003.1(2016/18)/Issue7+TC2] Shell and Utilities||Editorial||Clarification Requested||2023-07-18 17:45||2023-08-22 14:46|
|Final Accepted Text|
|Summary||0001767: sed: clarify behavior of c (change) command|
There's some confusion about the behavior of the sed c (change) command. Most implementations interpret it as starting the next cycle on every line that its address range matches. Meaning, any command after it in the script is not processed. Others interpret "start the next cycle" as only occurring at the end of the address range i.e. that commands following the change command are processed except on the last line of the address range.
The implementations that implement the former behavior are:
- GNU sed
- NetBSD sed
- Busybox sed
- Plan 9 sed
Those that don't are:
- FreeBSD sed
- OpenBSD sed
This has been acknowledged as a bug in FreeBSD.
This was previously corrected in NetBSD with the following explanation, referencing the V7 man page:
sed(1) "c" command is in some sense a shorthand for "i"+"d", so,
like "d" it should start the next cycle. This is explicitly documented
in v7 man page:
Delete the pattern space. With 0 or 1 address or at the end of a
2-address range, place text on the output. Start the next cycle.
NetBSD commit: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45981 [^]
FreeBSD bug report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271817 [^]
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.
Delete the pattern space. With a 0 or 1 address or at the end of a 2-address range, place text on the output. Start the next cycle.
|Ed Note: The word "text" in the Desired Action is intended to stay italicized.|
|2023-07-18 17:45||mohd_akram||New Issue|
|2023-07-18 17:45||mohd_akram||Name||=> Mohamed Akram|
|2023-07-18 17:45||mohd_akram||Section||=> sed|
|2023-07-18 17:45||mohd_akram||Page Number||=> 3219|
|2023-07-18 17:45||mohd_akram||Line Number||=> 108018|
|2023-07-27 15:40||Don Cragun||Interp Status||=> ---|
|2023-07-27 15:40||Don Cragun||Status||New => Resolved|
|2023-07-27 15:40||Don Cragun||Resolution||Open => Accepted|
|2023-07-27 15:41||Don Cragun||Tag Attached: issue8|
|2023-07-27 15:42||shware_systems||Note Added: 0006405|
|2023-08-22 14:46||geoffclare||Status||Resolved => Applied|
|2023-08-22 14:46||geoffclare||Tag Attached: applied_after_i8d3|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|