On Thu, 8 Jun 017, Paul Goyette wrote: >Getting closer. When the original match was in the context info, the output is fine. > >But if the original match was in the title line, the output from > > grep -B2 > >includes context info from some previous match whether or not it contains the actual 'lfs' string. > >> This suggests that the "no stem" option could be implemented in man as >> a post-process, after the query, with negligible loss of efficiency.
Grep is a blunt instrument... My real point was at the end: I reckon it's an easy bit of C code to do the filter inside 'man', and then get exactly what you want. In other words: keep the indexing scheme the same and just post-process inside man to discard the extra matches. There is basically no reason to try to make this more efficient; the index has already done the heavy lifting. Best regards, --Terry