Article View: comp.sys.sun
Article #8420Sed incompatibility in SunOS 4.x
From: trinkle
Date: Wed, 05 Jun 1991 14:17
Date: Wed, 05 Jun 1991 14:17
42 lines
2359 bytes
2359 bytes
For some reason, Sun apparently changed the behavior of the "p"
flag for the "s" command. In BSD 4.3 and derived systems, the p flag
causes the new pattern to be copied to stdout if a replacement is
made. The SunOS 4.0.3 and 4.1.1 documentation imply this is still the
case
(2)s/regular expression/replacement/flags
Substitute the replacement string for instances
of the regular expression in the pattern space.
Any character may be used instead of `/'. For a
fuller description see ed(1). flags is zero or
more of:
n n= 1 - 512. Substitute for just the
nth occurrence of the
regularexpression.
g Global: substitute for all nonover-
lapping instances of the regular
expression rather than just the
first one.
p Print the pattern space if a
replacement was made.
w wfilename Write: append the pattern space to
wfilename if a replacement was made.
But in fact, it is not true. The pattern is copied to stdout
ONLY if the -n option was specified on the command line. I have
looked at both the 4.0.3 and 4.1.1 source code, and it is clearly
deliberate.
I am not that familiar with the SysV version of sed. Is this
merely a compatibility issue with SysV that is incorrectly documented,
or did Sun gratuitously decide to change a very basic utility?
Daniel Trinkle trinkle@cs.purdue.edu
Dept. of Computer Sciences {backbone}!purdue!trinkle
Purdue University 317-494-7844
West Lafayette, IN 47907
Technical Details
Message-ID:
<3663@brchh104.bnr.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: trinkle@cs.purdue.edu Newsgroups: comp.sys.sun Subject: Sed incompatibility in SunOS 4.x Keywords: No Digest Subjects in Unmoderated Mode Message-ID: <3663@brchh104.bnr.ca> Date: 5 Jun 91 14:17:00 GMT Sender: news@brchh104.bnr.ca Organization: Sunspots, Pseudo-Unmoderated Lines: 43 Approved: sun-spots@rice.edu X-Original-Date: Thu, 30 May 91 18:21:00 EST