Article View: gnu.utils.bug
Article #1235sed-1.12 bug (I think)
From: Owner of system commands
Date: Fri, 18 Dec 1992 11:44
Date: Fri, 18 Dec 1992 11:44
57 lines
1771 bytes
1771 bytes
Machine: Intel 386 running a fairly gnu-ized SCO Unix.
Sed version: sed-1.12
When sed is given a command of the form
sed -n 's/foo/bar/p'
shouldn't sed print _only_ the lines that have been substituted?
Before the "bug", sed prints nothing. A
sed 's/foo/bar/p'
prints duplicates of the substituted lines. My stock sed does what
I expect, but maybe I'm wrong. I fixed the "bug" by doing:
- A PATCH -- A PATCH -- A PATCH -- A PATCH -- A PATCH -- A PATCH -
--- sed.c.orig Fri Dec 18 16:28:00 1992
+++ sed.c Fri Dec 18 16:27:47 1992
@@ -1567,7 +1567,7 @@
ck_fwrite (line.text, 1, line.length,
cur_cmd->x.cmd_regex.wio_file);
if (cur_cmd->x.cmd_regex.flags & S_PRINT_BIT
- && !no_default_output)
+ || !no_default_output)
ck_fwrite (line.text, 1, line.length, stdout);
break;
- A PATCH -- A PATCH -- A PATCH -- A PATCH -- A PATCH -- A PATCH -
If the file /tmp/foo contains the following two lines:
GFLAG:="-g"
AND:=""
and I issue the command
cat /tmp/foo | sed -n -e 's/^\([A-Z][A-Z]*:=\)"\(..*\)"$/\1 \2/p'
I get nothing. If I use SCO's sed, I get
GFLAG:= -g
If I do
cat /tmp/foo | sed -e 's/^\([A-Z][A-Z]*:=\)"\(..*\)"$/\1 \2/p'
I get
GFLAG:= -g
GFLAG:= -g
AND:=""
Hope this is enough information.
Thanks for the good tools.
mike@sojurn.lns.pa.us
Technical Details
Message-ID:
<m0n2pUq-00020qM@sojurn.lns.pa.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sojurn.lns.pa.US!binShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sojurn.lns.pa.US!bin From: bin@sojurn.lns.pa.US (Owner of system commands) Subject: sed-1.12 bug (I think) Message-ID: <m0n2pUq-00020qM@sojurn.lns.pa.us> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 18 Dec 1992 11:44:34 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 58