Second thought, maybe the 'i.e.'s should be changed to 'e.g.'s, because '/' and '?' also work (instead of '//' and '??', respectively), so '/re' and '?re' are indeed only examples.
Or maybe this is overdoing it. I don't know. Whatever you all think is best and most correct. I have no strong personal opinion on this. I'm just trying to respond to mazocomp's reasonable observation and suggestion. Ian On 07/07/2019, ropers <rop...@gmail.com> wrote: > mazocomp opined: >> Hi! >> >> I am not good at explaining something shortly and clearly to fit into >> proper documentation, so I'll just describe my experience here. >> >> Terminating regular expressions with / or ? is necessary only if they >> are followed by commands, otherwise the following are legal in both >> OpenBSD ed, Plan 9 ed and GNU ed: >> /something >> / >> ? >> g/ing >> >> I hope I made life of many ed users easier :) > > >> On Thu, Jul 04, 2019 at 11:47:50PM +0200, ropers wrote: >>> Do I understand correctly that this is in reference to these parts of >>> man >>> 1 ed: >>> >>> > /re/ >>> > The next line containing the regular expression re. The search >>> > wraps >>> > to the beginning of the buffer and continues down to the current line, >>> > if necessary. ???//??? repeats the last search. >>> >>> > ?re? >>> > The previous line containing the regular expression re. The search >>> > wraps to the end of the buffer and continues up to the current line, >>> > if >>> > necessary. ???????? repeats the last search. >>> >>> and: >>> >>> > (1,$)g/re/command-list >>> > Applies command-list to each of the addressed lines matching a >>> > regular expression re. The current address is set to the line >>> > currently >>> > matched before command-list is executed. At the end of the g command, >>> > the current address is set to the last line affected by command-list. >>> > If >>> > no lines were matched, the current line number remains unchanged. >>> > >>> > Each command in command-list must be on a separate line, and every >>> > line except for the last must be terminated by a backslash (???\???). >>> > Any commands are allowed, except for g, G, v, and V. A newline alone >>> > in >>> > command-list is equivalent to a p command. >>> >>> >>> If yes, then the corresponding parts of ed.1 are: >>> >>> <snip snip sauce> >>> >>> and: >>> >>> <snip sauce> >>> >>> I'm not actually sure how to rewrite that. Would this call for >>> separate /re, ?re and (1,$)g/re entries, or would it suffice to say >>> that the second question mark or slash can be omitted if immediately >>> followed by a newline? >>> >>> Does anyone else have any ideas? >>> >>> NB: In case people haven't seen it, here's an excellent ed(1) >>> tutorial: https://sanctum.geek.nz/arabesque/actually-using-ed/ >>> I just thought I'd mention that. > > > Mohamed proffered: >> To add to Ian's reference. "Ed Mastery" is the only book I know >> specific to ed(1). >> >> Mo > > > Jason McIntyre expounded: >> >> hi. >> >> if we were going to document it, i'd say it definitely wouldn;t warrant >> adding separate entries. it would be enough to describe when the / or ? >> were optional. >> >> neither freebsd nor netbsd seemingly document this. >> >> posix documents it for /re/ and ?re?, but not g/RE/command-list, like >> this: >> >> In addition, the second <slash> can be omitted at the end of a >> command line. >> >> without having tested any of this, i guess we'd want to add such a note >> to /re/ and ?re?, but not g/RE/command-list. something along the lines >> of: >> >> The second slash is optional when followed by a newline. >> >> you could ping a diff to tech, and see if anyone has any input that >> could help. if no one does, i'll take it. > > > Okay, so since nobody else appears to be making any pertinent noise, I > guess it falls to me: > > Index: ed.1 > =================================================================== > RCS file: /cvs/src/bin/ed/ed.1,v > retrieving revision 1.70 > diff -u -r1.70 ed.1 > --- ed.1 26 Apr 2018 12:18:54 -0000 1.70 > +++ ed.1 6 Jul 2019 21:20:15 -0000 > @@ -269,6 +269,9 @@ > current line, if necessary. > .Qq // > repeats the last search. > +The second slash is optional for a bare search without any suffixed > command, i.e.\& > +.Qq / Ns Ar re > +is sufficient when followed by a newline. > .It Pf ? Ar re ? > The previous line containing the regular expression > .Ar re . > @@ -276,6 +279,9 @@ > current line, if necessary. > .Qq ?? > repeats the last search. > +The second question mark is optional for a bare search without any > suffixed command, i.e.\& > +.Ns Qq ? Ns Ar re > +is sufficient when followed by a newline. > .It \&' Ns Ar lc > The line previously marked by a > .Ic k > > Questions? Comments? Complaints? Secondary trade sanctions? > > And no, don't ask me how much of my weekend I wasted figuring out how > to suppress mandoc's insistence upon two spaces after the 'i.e.' just > because there's a period at the end of a line. Because *&#%$!!! > everything about the &"£$" of @~"£$"£ '£$""! Which I'm saying with > love and in the best possible humour of course. > > Ian > > PS: > Oh, and Mo: At the peril of joking about weak-sauce wedge issues that > were astroturficially whipped up and media-amplified for *divide et > impera* purposes: The Manly McManface Edition of Ed Mastery lends a > whole new meaning to `man ed`. >