Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2002 18:53:35 +1000
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        current@FreeBSD.ORG
Subject:   [tjr@FreeBSD.org: cvs commit: src/usr.bin/sed main.c]
Message-ID:  <20020616185335.A25500@dilbert.robbins.dropbear.id.au>

next in thread | raw e-mail | index | archive | help
Does this fix the recent problems people were having with sed?
The examples I could dig up on the web that use the `N' command work
properly with this change (same as they do on -DP1).

Here are a few of the examples that are fixed:
(from http://www.faqs.org/faqs/editor-faq/sed/)

   # 10. Delete all CONSECUTIVE blank lines from file except the first.
   # This method also deletes all blank lines from top and end of file.
   # (emulates "cat -s")
   sed '/./,/^$/!d' file       # this allows 0 blanks at top, 1 at EOF
   sed '/^$/N;/\n$/D' file     # this allows 1 blank at top, 0 at EOF

   # 12. Delete all trailing blank lines at end of file (only).
   sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' file

   # 13. If a line ends with a backslash, join the next line to it.
   sed -e :a -e '/\\$/N; s/\\\n//; ta' file

If this change doesn't fix the problems, please give me small and simple
sed scripts that demonstrate the incorrect behaviour.


Tim


----- Forwarded message from "Tim J. Robbins" <tjr@FreeBSD.org> -----

Delivered-To: tjr@freebsd.org
Delivered-To: cvs-committers@freebsd.org
From: "Tim J. Robbins" <tjr@FreeBSD.org>
Date: Sun, 16 Jun 2002 01:44:39 -0700 (PDT)
To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject: cvs commit: src/usr.bin/sed main.c
X-FreeBSD-CVS-Branch: HEAD
Precedence: bulk
X-Loop: FreeBSD.ORG

tjr         2002/06/16 01:44:39 PDT

  Modified files:
    usr.bin/sed          main.c 
  Log:
  Correct the handling of (for example) the N command by only zeroing the
  input space in mf_fgets() if we reach the end of all input files.
  
  Revision  Changes    Path
  1.24      +2 -1      src/usr.bin/sed/main.c

----- End forwarded message -----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020616185335.A25500>