sed man page error (Was "Re: sed question")
Martin Foord
maf at thor.dbsm.oz.au
Wed May 29 17:40:28 AEST 1991
In article <1991May17.211650.2025 at ultra.com> marc at 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 at dbsm.oz.au
SBC Dominguez Barry. Internet Gateway:
Phone: +61-2-258-2724 maf%dbsm.oz.au at munnari.oz.au
More information about the Comp.unix.shell
mailing list