This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU sed 3.95 released

GNU sed 3.95 has been released.  This is an alpha release for the upcoming
GNU sed 4.0 release.

GNU sed 3.95 merges most of the changes in the free-software super-sed
project.  In particular:

* Can customize line wrap width on single `l' commands

* `L' command formats and reflows paragraphs like `fmt' does.

* The test suite makefiles are better organized (this change is transparent

* Compiles and bootstraps out-of-the-box under MinGW32 and Cygwin.

* Optimizes cases when pattern space is truncated at its start or at its end
by `D' or by a substitution command with an empty RHS. For example scripts
like this,

    seq 1 10000 | tr \\n \  | ./sed ':a; s/^[0-9][0-9]* //; ta'

whose behavior was quadratic with previous versions of sed, have now linear

* Bug fix: Made the behavior of s/A*/x/g (i.e. `s' command with a
possibly empty LHS) more consistent:

       pattern               GNU sed 3.x       GNU sed 4.x
        B                      xBx               xBx
        BC                     xBxCx             xBxCx
        BAC                    xBxxCx            xBxCx
        BAAC                   xBxxCx            xBxCx

* Check for invalid backreferences in the RHS of the `s' command (e.g.

* Support for \[lLuUE] in the RHS of the `s' command like in Perl.

* New regular expression matcher

* Bug fix: if a file was redirected to be stdin, sed did not consume it.  So
      (sed d; sed G) < TESTFILE

double-spaced TESTFILE, while the equivalent `useless use of cat'
      cat TESTFILE | (sed d; sed G)

printed nothing (which is the correct behavior).  A test for this bug was
added to the test suite.

* The documentation is now much better, with a few examples provided, and a
thorough description of regular expressions.

* New option -i, to support in-place editing a la Perl.  Usually one had to
use ed or, for more complex tasks, resort to Perl; this is not necessary

* Added new command-line options:
  -u, --unbuffered
    Do not attempt to read-ahead more than required; do not buffer stdout.
  -l N, --line-length=N
    Specify the desired line-wrap length for the `l' command.
    A length of "0" means "never wrap".

* Documented command-line option:
  -r, --regexp-extended
    Use extended regexps -- e.g. (abc+) instead of \(abc\+\)

* Added feature to the `w' command and to the `w' option of the `s' command:
if the file name is /dev/stderr, it means the standard error (inspired by
awk); and similarly for /dev/stdout.  This is disabled if POSIXLY_CORRECT is

* Added `m' and `M' modifiers to `s' command for multi-line matching
(Perl-style); in addresses, only `M' works.

* New option `e' to pass the output of the `s' command through the Bourne
shell and get the result into pattern space.

* Added `e' commnad to pipe the output of a command into the output of sed.

* Added `Q' command for `silent quit'; added ability to pass an exit code
from a sed script to the caller.

* Added `R' command to read a single line from a file.

* Added `W' command to write first line of pattern space to a file

* Added `T' command for `branch if failed'.

* Added `v' command, which is a do-nothing intended to fail on seds that do
not support super-sed's extensions.

* New internationalization translations added: fr ru de it el sk pt_BR sv
(some of them need updating)

* The s/// command now understands the following escapes (in both halves):
 \a an "alert" (BEL)
 \f a form-feed
 \n a newline
 \r a carriage-return
 \t a horizontal tab
 \v a vertical tab
 \oNNN a character with the octal value NNN
 \dNNN a character with the decimal value NNN
 \xNN a character with the hexadecimal value NN
This behavior is disabled if POSIXLY_CORRECT is set, at least for the time
being (until I can be convinced that this behavior does not violate the
POSIX standard).  (Incidentally, \b (backspace) was omitted because of the
conflict with the existing "word boundary" meaning. \ooo octal format was
omitted because of the conflict with backreference syntax.)

* If POSIXLY_CORRECT is set, the empty RE // now is the null match instead
of "repeat the last REmatch".  As far as I can tell this behavior is
mandated by POSIX, but it would break too many
legacy sed scripts to blithely change GNU sed's default behavior.

This release is known to have bugs.  Some can remain in GNU sed 4.0, but not
those that for example give problems when configuring packages, because this
would seriously hinder the usability of a GNU system.  Please try GNU sed
3.95 to configure your favorite packages on your favorite architecture, and
report whatever goes wrong to the maintainer at

(libc-alpha CCed because the bigger test suite might interest the folks

FTP site for GNU sed 3.95
Web site for super-sed

Paolo Bonzini

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]