GNU bug report logs - #64539
Possible issue with GNU sed documentation regarding the -n option

Previous Next

Package: sed;

Reported by: Ângelo Otávio Nuffer Nunes <angelonuffer <at> gmail.com>

Date: Sun, 9 Jul 2023 09:08:01 UTC

Severity: normal

To reply to this bug, email your comments to 64539 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#64539; Package sed. (Sun, 09 Jul 2023 09:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ângelo Otávio Nuffer Nunes <angelonuffer <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Sun, 09 Jul 2023 09:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ângelo Otávio Nuffer Nunes <angelonuffer <at> gmail.com>
To: bug-sed <at> gnu.org
Subject: Possible issue with GNU sed documentation regarding the -n option
Date: Sat, 8 Jul 2023 19:35:18 -0300
[Message part 1 (text/plain, inline)]
Dear GNU sed maintainers,

I am writing to report a possible issue with the documentation for the `-n`
option in GNU `sed`. According to the documentation available at
https://www.gnu.org/software/sed/manual/html_node/Command_002dLine-Options.html,
the `-n` option should cause `sed` to only produce output when explicitly
told to via the `p` command.

However, based on responses and comments on this Stack Overflow post (
https://stackoverflow.com/questions/76633771/why-does-gnu-sed-print-output-when-using-the-n-option-with-the-a-command/76639116#76639116)
and my own tests, it appears that several other commands, including `=`,
`l`, `r`, `a`, `i`, and `c`, also produce output even when the `-n` option
is used.

I am still learning how to use GNU `sed`, so I may be misunderstanding
something. However, I wanted to bring this to your attention in case there
is an issue with the documentation that needs to be addressed.

Thank you for your time and for all the work you do on GNU `sed`.

Best regards,
Ângelo Nuffer
[Message part 2 (text/html, inline)]

Information forwarded to bug-sed <at> gnu.org:
bug#64539; Package sed. (Wed, 24 Jul 2024 09:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 64539 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Ângelo Otávio Nuffer Nunes <angelonuffer <at> gmail.com>
Cc: 64539 <at> debbugs.gnu.org
Subject: Re: Possible issue with GNU sed documentation regarding the -n option
Date: Wed, 24 Jul 2024 11:19:47 +0200
Hi,

On 2023-07-08 19:35:18 -0300, Ângelo Otávio Nuffer Nunes wrote:
> I am writing to report a possible issue with the documentation for the `-n`
> option in GNU `sed`. According to the documentation available at
> https://www.gnu.org/software/sed/manual/html_node/Command_002dLine-Options.html,
> the `-n` option should cause `sed` to only produce output when explicitly
> told to via the `p` command.
> 
> However, based on responses and comments on this Stack Overflow post (
> https://stackoverflow.com/questions/76633771/why-does-gnu-sed-print-output-when-using-the-n-option-with-the-a-command/76639116#76639116)
> and my own tests, it appears that several other commands, including `=`,
> `l`, `r`, `a`, `i`, and `c`, also produce output even when the `-n` option
> is used.

Perhaps the doc of -n implicitly means that this is specifically the
output of the current pattern space at the end of a cycle (as done by
default, which is what this paragraph is about). Said otherwise, with
the -n option, to get the same behavior as the default one, one would
need a p command at the end of the script.

I think that "via the p command" could be removed, or "for example"
could be added.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




This bug report was last modified 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.