Date: Sun, 18 Jun 2023 22:14:52 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 271817] sed: range change with N results in no output Message-ID: <bug-271817-227-8ak5ybsgbK@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-271817-227@https.bugs.freebsd.org/bugzilla/> References: <bug-271817-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271817 --- Comment #3 from Andrew "RhodiumToad" Gierth <andrew@tao11.riddles.org.u= k> --- (In reply to Mohamed Akram from comment #2) All of the pattern space (embedded newlines and all) is deleted at the end = of each cycle (after being output if appropriate). The fact the GNU sed violates the spec is not our concern. Your description of the "c" command is not what the spec says. The spec says that with 2 addresses, "c" deletes the pattern space if the line is in the addressed range, and emits the replacement text if and only if the last lin= e of the range is addressed. Since the "b" line is consumed by N and is never in= the pattern space at the start of the cycle, the /a/,/b/ range never sees it, so the range extends to the last line of the file; but since you also read the last line of the file by doing N on the second-last line, the last line is = also never processed by the "c" command so the replacement is never output. (You seem to be assuming that the use of N does not affect addresses; that's not what the spec says.) --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271817-227-8ak5ybsgbK>