[Top][All Lists]

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

Re: FYI: Sed portability (Was: sed usage in autoheader)

From: Paul Eggert
Subject: Re: FYI: Sed portability (Was: sed usage in autoheader)
Date: Thu, 16 Nov 2000 12:35:16 -0800 (PST)

> From: Akim Demaille <address@hidden>
> Date: 16 Nov 2000 10:45:57 +0100

> We do agree `/foo[\/]bar/' is a single pattern which matches the
> string `foo/bar', right?  Then, why do you use the char class here?

Because, if my admittedly fallible memory serves, some older hosts
mishandle /foo\/bar/.  I don't think they're worth worrying about
at this point, though.

As I recall, the principal use of [\/] was in search regular
expressions, not in substitution regular expressions.  For example, if
you know the data cannot contain backslash, then `/foo[\/]bar/s/a/b/'
is equivalent to the POSIX `/foo\/bar/s/a/b/'.

> +Alternation, @samp{\|}, is common but not portable.
> address@hidden FIXME: I know Solaris is guilty, but I don't remember how.

Solaris 8 sed does not support alternation.  E.g. "sed '/a\|b/d'"
deletes only lines that contain the literal string "a|b".  POSIX.2
does not require support for \|, so it should be avoided in portable

reply via email to

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