From 994354bb4fd052bc030bbd11ad00a22b9b17bc91 Mon Sep 17 00:00:00 2001 From: David A. Wheeler Date: Wed, 16 Oct 2013 23:36:49 -0400 Subject: [PATCH] Modify documentation to note sed "-E" option, now in POSIX, for EREs. 2013-10-16 David A. Wheeler * doc/sed-in.texi: Document "-E" option to use EREs. GNU sed already supported "-E" as an undocumented synonym for "-r", but "-E" is now in POSIX. See: http://austingroupbugs.net/view.php?id=528. * doc/sed.1: Likewise. * doc/sed.texi: Likewise. * doc/sed.x: Likewise. * sed/sed.c: Likewise. --- ChangeLog | 10 ++++++++++ doc/sed-in.texi | 15 ++++++++++++--- doc/sed.1 | 10 +++++++--- doc/sed.texi | 17 +++++++++++++---- doc/sed.x | 5 ++++- sed/sed.c | 6 +++--- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e1a0c2..da1d6fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-10-16 David A. Wheeler + + * doc/sed-in.texi: Document "-E" option to use EREs. GNU sed already + supported "-E" as an undocumented synonym for "-r", but "-E" is now + in POSIX. See: http://austingroupbugs.net/view.php?id=528. + * doc/sed.1: Likewise. + * doc/sed.texi: Likewise. + * doc/sed.x: Likewise. + * sed/sed.c: Likewise. + 2013-10-06 Jose E. Marchesi * basicdefs.h (PATH_MAX): Defined to some constant in case it is diff --git a/doc/sed-in.texi b/doc/sed-in.texi index 40ba70b..1ed602f 100644 --- a/doc/sed-in.texi +++ b/doc/sed-in.texi @@ -318,8 +318,10 @@ follow the link and edit the ultimate destination of the link. The default behavior is to break the symbolic link, so that the link destination will not be modified. address@hidden -r address@hidden -E address@hidden -r @itemx --regexp-extended address@hidden -E @opindex -r @opindex --regexp-extended @cindex Extended regular expressions, choosing @@ -327,8 +329,15 @@ so that the link destination will not be modified. Use extended regular expressions rather than basic regular expressions. Extended regexps are those that @command{egrep} accepts; they can be clearer because they -usually have less backslashes, but are a @acronym{GNU} extension -and hence scripts that use them are not portable. +usually have fewer backslashes. +Historically this was a @acronym{GNU} extension, +but the @option{-E} +extension has since been added to the POSIX standard +(http://austingroupbugs.net/view.php?id=528), +so use @option{-E} for portability. +GNU sed has accepted @option{-E} as an undocumented option for years, +and *BSD seds have accepted @option{-E} for years as well, +but scripts that use @option{-E} might not port to other older systems. @xref{Extended regexps, , Extended regular expressions}. @ifset PERL diff --git a/doc/sed.1 b/doc/sed.1 index 7acbcd0..2f02e64 100644 --- a/doc/sed.1 +++ b/doc/sed.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28. -.TH SED "1" "February 2013" "sed 4.2.2" "User Commands" +.TH SED "1" "October 2013" "sed 4.2.2" "User Commands" .SH NAME sed \- stream editor for filtering and transforming text .SH SYNOPSIS @@ -48,9 +48,10 @@ specify the desired line-wrap length for the `l' command .IP disable all GNU extensions. .HP -\fB\-r\fR, \fB\-\-regexp\-extended\fR +\fB\-E\fR, \fB\-r\fR, \fB\-\-regexp\-extended\fR .IP -use extended regular expressions in the script. +use extended regular expressions in the script +(for portability use POSIX \fB\-E\fR). .HP \fB\-s\fR, \fB\-\-separate\fR .IP @@ -367,6 +368,9 @@ and similarly for .BR \ea , .BR \et , and other sequences. +The \fI-E\fP option switches to using extended regular expressions instead; +the -E option has been supported for years by GNU sed, and is now +included in POSIX. .SH BUGS .PP E-mail bug reports to diff --git a/doc/sed.texi b/doc/sed.texi index 2bee542..a86ac6d 100644 --- a/doc/sed.texi +++ b/doc/sed.texi @@ -319,8 +319,10 @@ follow the link and edit the ultimate destination of the link. The default behavior is to break the symbolic link, so that the link destination will not be modified. address@hidden -r address@hidden -E address@hidden -r @itemx --regexp-extended address@hidden -E @opindex -r @opindex --regexp-extended @cindex Extended regular expressions, choosing @@ -328,8 +330,15 @@ so that the link destination will not be modified. Use extended regular expressions rather than basic regular expressions. Extended regexps are those that @command{egrep} accepts; they can be clearer because they -usually have less backslashes, but are a @acronym{GNU} extension -and hence scripts that use them are not portable. +usually have fewer backslashes. +Historically this was a @acronym{GNU} extension, +but the @option{-E} +extension has since been added to the POSIX standard +(http://austingroupbugs.net/view.php?id=528), +so use @option{-E} for portability. +GNU sed has accepted @option{-E} as an undocumented option for years, +and *BSD seds have accepted @option{-E} for years as well, +but scripts that use @option{-E} might not port to other older systems. @xref{Extended regexps, , Extended regular expressions}. @ifset PERL @@ -814,7 +823,7 @@ operators. @item address@hidden Matches the @var{digit}-th @code{\(@dots{}\)} parenthesized subexpression in the regular expression. This is called a @dfn{back -reference}. Subexpressions are implicitly numbered by counting +reference}. Subexpressions are implicity numbered by counting occurrences of @code{\(} left-to-right. @item \n diff --git a/doc/sed.x b/doc/sed.x index 433d52f..401bd88 100644 --- a/doc/sed.x +++ b/doc/sed.x @@ -4,7 +4,7 @@ sed \- a Stream EDitor .nf sed [-V] [--version] [--help] [-n] [--quiet] [--silent] [-l N] [--line-length=N] [-u] [--unbuffered] - [-r] [--regexp-extended] + [-E] [-r] [--regexp-extended] [-e script] [--expression=script] [-f script-file] [--file=script-file] [script-if-no-other-script] @@ -312,6 +312,9 @@ and similarly for .BR \ea , .BR \et , and other sequences. +The \fI-E\fP option switches to using extended regular expressions instead; +the -E option has been supported for years by GNU sed, and is now +included in POSIX. [SEE ALSO] .BR awk (1), diff --git a/sed/sed.c b/sed/sed.c index af985e6..cff1505 100644 --- a/sed/sed.c +++ b/sed/sed.c @@ -125,8 +125,9 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\ specify the desired line-wrap length for the `l' command\n")); fprintf(out, _(" --posix\n\ disable all GNU extensions.\n")); - fprintf(out, _(" -r, --regexp-extended\n\ - use extended regular expressions in the script.\n")); + fprintf(out, _(" -E, -r, --regexp-extended\n\ + use extended regular expressions in the script\n\ + (for portability use POSIX -E).\n")); #ifdef REG_PERL fprintf(out, PERL_HELP); #endif @@ -277,7 +278,6 @@ main(argc, argv) write_mode = "wb"; break; - /* Undocumented, for compatibility with BSD sed. */ case 'E': case 'r': if (extended_regexp_flags) -- 1.6.2.5