Subject: Re: bug#75582: GNU grep 3.4 — enhancing manual

From: [email-masked]
Date: Thu, 16 Jan 2025 22:51:19 -0600

sur-behoffski wrote:
>> Blending in documentation about -h immediately made me curious.

Speaking off the cuff, without benefit of looking at the code or sufficient experimenting with the behavior, I would expect that:

By default, if more than one file argument is named on the command line or is potentially implied by the "-r" recursive option, grep prefixes each line of output with the file name in which it was found, whereas if only one file is explicitly named, or only the standard input is being searched, then grep suppresses the prefixing of file names on output.  The "-h" and "-H" options override these defaults, to either never ("-h") or always ("-H") prefix each line of output with the file name in which it was found.  If "-H" is specified and grep is searching its standard input, that input file name prefix is the string "(standard input)".

Clearly my previous paragraph fails the "keep word count parsimonious" mandate for man pages.  Perhaps the two man page paragraphs, one for "-h" and the next one for "-H", could be combined into a single paragraph, derived from some parsimonious variant of my above paragraph, explaining both the "-h" and "-H" options.

-- 
Paul Jackson
[email-masked]