Newline-issues with c, i, and a command in sed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Newline-issues with c, i, and a command in sed

Andreas Kusalananda Kähäri-4
Hi,

I wonder if this is the expected and correct behaviour of OpenBSD sed(1):

$ cat file
1
2
3

$ sed -e '1c\' -e 'A' file
A2
3

$ sed -e '1i\' -e 'A' file
A1
2
3

$ sed -e '1a\' -e 'A' file
1
A2
3


I was expecting the 'A' to be followed by a newline in all of the above
cases.  I can't for the life of me figure out how to insert that newline
without resorting to using GNU sed.


This is on

OpenBSD 6.4-current (GENERIC.MP) #634: Sat Jan 26 15:39:11 MST 2019
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP


Regards,

--
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.