This fixes the issue for me, but I'm not sure about the motivation behind the check. Maybe schwarze@ can shed some light on it, since he's to (cvs) blame for the particular line.
martijn@ On 09/24/17 15:42, Andreas Kusalananda Kähäri wrote: > Hi, > > Given the input file of three lines: > > line 1 > line 2 > line 3 > > and the sed script > > s/\</\ > /g > s/^/hello/ > > which inserts a newline in front of every word and then prepends the > word "hello" to the beginning of the pattern space. > > The following happens: > > $ sed -f script.sed input.txt > hello > > hello > > hello > > > I was expecting to get > > hello > line > 1 > hello > line > 2 > hello > line > 3 > > This is a bit surprising since running only the first sed expression > gives (as expected) > > > line > 1 > > line > 2 > > line > 3 > > > The question is, why does the "line N" data disappear when inserting a > word at the start of the pattern space here? > > I'm also noticing that this does not happen if a space (for instance) > precedes the escaped newline in the first expression: > > s/\</ \ > /g > s/^/hello/ > > > This is using sed in the base system on OpenBSD 6.1-stable (amd64). > > Cheers, >

