Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!munnari.oz.au!metro!dbsm!maf From: maf@thor.dbsm.oz.au (Martin Foord) Newsgroups: comp.unix.shell Subject: Re: sed man page error (Was "Re: sed question") Message-ID: <1991May29.074028.13085@dbsm.oz.au> Date: 29 May 91 07:40:28 GMT Article-I.D.: dbsm.1991May29.074028.13085 References: <3880@wb3ffv.ampr.org> <1991May16.085837.1368@ultra.com> <1991May17.211650.2025@ultra.com> Sender: maf@dbsm.oz.au (Martin Foord) Reply-To: maf@thor.dbsm.oz.au (Martin Foord) Distribution: comp Organization: SBC Dominguez Barry Ltd Lines: 65 In article <1991May17.211650.2025@ultra.com> marc@mercutio.ultra.com (Marc Kwiatkowski {Host Software-AIX}) writes: >I'd point out the sed documentation error that exists in every >sed man page I've ever seen. > >From 4.3BSD URM sed man page: > > n Copy the pattern space to the standard output. Replace > the pattern space with the next line of input. > >It should read: > > n Copy the pattern space to the standard output unless > "-n" flag has been specified. Replace > the pattern space with the next line of input. > >It is surprising that this documentation error has existed for >so long, and has been reproduced so faithfully by numerous >Unices. It makes one suspect that the additional features >of sed aren't used by many. Yes. I think so. Here are a few more bugs in the man page I've discovered : : : p Print the pattern space if a : replacement was made. Shouldn't this be something like : Print the pattern space if a replacement was made and the '-n' option has been specifyed. : : w wfilename Write: append the pattern space to : wfilename if a replacement was made. : ... : : (2)w wfilename : Write: append the pattern space to wfilename. : And a nasty but subtle one in both of the above writes, should probably read something like : Write : Create a new file wfilename and then append the pattern space to wfilename. An unsuspecting reader of the manual could assume that w will NOT clobber wfilename first but append on the already existing wfilename. >If you'll allow me to get on my soapbox, I'd like to campaign >for sed. sed's syntax is somewhat obtuse, but it takes far >less time to load than awk. Since most of shell-script Yes, I tend to agree here. The major problem with sed is as you say, the arcane syntax, and lots of backslash regexs. Therefore it's not a trivial exercise to learn the FULL capabilities of sed and so few do. It'd be good to see this updated (eg: give sed a more egrepish like set of regexs), then again one could basically be doing all this with perl -[p|n]e ... Martin. -- Martin Foord. MHSnet/ACSnet: maf@dbsm.oz.au SBC Dominguez Barry. Internet Gateway: Phone: +61-2-258-2724 maf%dbsm.oz.au@munnari.oz.au