Hi, Philip Guenther wrote on Wed, Oct 22, 2014 at 10:46:43AM -0700:
> That looks like a documentation bug to me. To quote the POSIX spec: > ---------- > [2addr] {editing command > editing command > ... > } > > Execute a list of sed editing commands only when the pattern space > is selected. The list of sed editing commands shall be surrounded > by braces and separated by <newline> characters, and conform to the > following rules. The braces can be preceded or followed by <blank> > characters. The editing commands can be preceded by <blank> characters, > but shall not be followed by <blank> characters. The <right-brace> > shall be preceded by a <newline> and can be preceded or followed > by <blank> characters. > ---------- > > So the newline before the close-brace is required. Since the code > matches the spec, I think we should change the doc to match both of > them. Or is there some reason this extension is required? That would be the following patch: Ingo Index: sed.1 =================================================================== RCS file: /cvs/src/usr.bin/sed/sed.1,v retrieving revision 1.43 diff -u -p -r1.43 sed.1 --- sed.1 27 May 2014 17:45:02 -0000 1.43 +++ sed.1 22 Oct 2014 19:36:54 -0000 @@ -268,7 +268,7 @@ Functions can be combined to form a .Em function list , a list of .Nm -functions separated by newlines, as follows: +functions each followed by a newline, as follows: .Bd -literal -offset indent { function function @@ -277,13 +277,8 @@ functions separated by newlines, as foll } .Ed .Pp -The -.Ql { -can be preceded or followed by whitespace. -The function can be preceded by whitespace as well. -The terminating -.Ql } -must be preceded by a newline or optional whitespace. +The braces can be preceded and followed by whitespace. +The functions can be preceded by whitespace as well. .Pp Functions and function lists may be preceded by an exclamation mark, in which case they are applied only to lines that are