[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document another sed portability problem

From: Paul Eggert
Subject: Re: document another sed portability problem
Date: Mon, 14 Aug 2006 15:57:42 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> I don't if the above behavior is forbidden by Posix;

POSIX isn't 100% clear on the subject, I'm afraid.

Anyway, thanks for reporting that.  I installed the following to
try to document the issues you mentioned.

2006-08-14  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Limitations of Usual Tools): Document sed
        problems with arg script text that doesn't end in newline, and
        with '-e a...'.  Problems reported by Ralf Wildenhues.

--- doc/autoconf.texi   10 Aug 2006 04:53:38 -0000      1.1066
+++ doc/autoconf.texi   14 Aug 2006 22:56:17 -0000      1.1068
@@ -13605,8 +13605,10 @@ $ @kbd{echo '1*23*4' | /usr/xpg4/bin/sed
 @end example
-The @option{-e} option is portable.
-Some people prefer to use it:
+The @option{-e} option is portable, so long as its argument
+does not begin with @samp{a}, @samp{c}, or @samp{i}
+(as this runs afoul of a Tru64 5.1 bug).
+Some people prefer to use @samp{-e}:
 sed -e '@var{command-1}' \
@@ -13671,18 +13673,27 @@ Also note that Posix requires that the @
 On the other hand, no white space is allowed between @samp{:} and the
 subsequent label name.
-Some @command{sed} implementations (e.g., MacOS X 10.4, Solaris 10
+If a sed script is specified on the command line and ends in an
address@hidden, @samp{c}, or @samp{i} command, the last line of inserted text
+should be followed by a newline.  Otherwise some @command{sed}
+implementations (e.g., address@hidden 3.9) do not append a newline to the
+inserted text.
+Many @command{sed} implementations (e.g., MacOS X 10.4,
address@hidden 3.9, Solaris 10
 @command{/usr/ucb/sed}) strip leading white space from the text of
 @samp{a}, @samp{c}, and @samp{i} commands.  Prepend a backslash to
 work around this incompatibility with Posix:
-$ @kbd{echo flushleft | sed -e 'a\}
address@hidden   indented'}
+$ @kbd{echo flushleft | sed 'a\}
+> @kbd{   indented}
+> @kbd{'}
-$ @kbd{echo foo | sed -e 'a\}
address@hidden   indented'}
+$ @kbd{echo foo | sed 'a\}
+> @kbd{\   indented}
+> @kbd{'}
 @end example

reply via email to

[Prev in Thread] Current Thread [Next in Thread]