[Bug 241206] sed "a" command issued on the command-line doesn't append a newline
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Dec 2021 20:55:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241206 jwdevel@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jwdevel@gmail.com --- Comment #1 from jwdevel@gmail.com --- I'm not sure this is a bug, just a difference in behavior between GNU sed and BSD sed (of which there are many). The docs for 'a' in "man 1 sed" say: "Write text to standard output immediately before each attempt to read a line of input". In my reading of that, since "text" does not contain a newline, neither does the output. You probably already know this, but this works in both cases: $ jot 2 | sed '/1/a\ > one point five > ' (That is, type the extra newline in your shell, before adding the terminating single-quote. This is the same as in your script example.) Though that might technically run afoul of GNU sed's documentation, which says "Append text, which has each embedded newline preceded by a backslash." I just put a raw newline there, not preceded by backslash. It does work though, regardless. -- You are receiving this mail because: You are the assignee for the bug.