On Fri, Dec 25, 2009 at 12:59:29PM -0500, Hugo Villeneuve wrote: > I had been using gnu sed for a while and encountered this issue > going with OpenBSD. ... > It's a cute work around. My point is: if a label can't contain > semicolons, why support "tlabel;" and not "t;"? I don't understand > the logic of it.
Keep in mind that GNU sed is not the standard version of sed, it contains many nonstandard features. The standard version of sed is specified by POSIX. The places where OpenBSD sed deviates from the POSIX standard are documented at http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/sed/POSIX?rev=1.2;content-type=text%2Fplain In particular, that document says that "Historic versions of sed permitted commands to be separated by semi-colons, e.g. 'sed -ne '1p;2p;3q' printed the first three lines of a file. This is not specified by POSIX. Note, the ; command separator is not allowed for the commands a, c, i, w, r, :, b, t, # and at the end of a w flag in the s command. This implementation follows historic practice and implements the ; separator." Basically, the semicolons are a nonstandard historic feature. If you want your sed scripts to be compatible with all Unix systems, then stick to the POSIX standard and use newlines or -e to separate commands.