Gary, thank you very much for your helpful response.

Sorry I failed to see this GNU extension/default and the -H and -h switches 
even though I looked :-)

Maybe a hint in the man entry for -o might be good; e.g. "Also see: -h, -H".


In hindsight, I also understand the effect of a peculiarity of HL7 files in 
this context:

I was grepping HL7 files. The HL7 standard uses only CR (hex 0D) to separate 
HL7 segments.

WITHOUT -o, grep results typically span multiple HL7 segments.
And CR means carriage return, so a filename displayed by grep would immediately 
be covered by content from the next segment.

WITH -o and a short search string, however, grep results remain within one HL7 
segment.
So NO CR appears in the output. So the filename displayed by grep remains 
visible.

This caused my (false) impression that in GNU grep, the -o would also trigger 
the -H with it.
And left me sufficiently puzzled to send this error report.
Of course, a closer inspection of grep output without -o could have revealed 
this!


I hope that documenting this here might help others avoid the same little trap 
:-)

Thanks & kind regards! Joerg



Reply via email to