GNU bug report logs -
#66434
grep recently shows the filename with -o , but it shouldn't.
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 1 year and 294 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.