Just encountered this discrepancy https://www.reddit.com/r/openbsd/comments/10v8gcl/just_got_signed_copies_of_ed_mastery_and_openbsd/j7j9usa/
and figured I'd document it on bugs@ in case it was worth addressing. In FreeBSD & GNU versions of ed(1), using a g// command followed directly by a backslash doesn't impact the list of commands issued: freebsd$ ed r !jot 10 21 g/3$/\ s/^/x/\ s/$/y/ 3 p x3y debian$ ed r !seq 10 21 g/3$/\ s/^/x/\ s/$/y/ 3 p x3y However, on OpenBSD, that empty operation preceding the backslash doesn't behave the same. It looks like it gets treated as an empty "enter" command (moving the cursor to the next line) and performing subsequent commands on the following line instead: openbsd$ ed r !jot 10 21 g/3$/\ s/^/x/\ s/$/y/ 4 p x4y I'm not sure which one should be the *right* behavior. POSIX describes it generically as a "command list" https://pubs.opengroup.org/onlinepubs/009695299/utilities/ed.html#tag_04_42_13_10 and clarifies that "an *empty* command list [should] be equivalent to the p command" (my emphasis added) but in this case, the *list* isn't empty; just the first "command" is empty. -tkc
