tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

RE: Suggestion: add a "no-stemming" option to apropos(1)?

On Thu, 8 Jun 2017, Terry Moore wrote:

On Thu, 8 Jun 017, Paul Goyette wrote:
PG>	Don't get me wrong, I love apropos(1).  But...
PG>	I'm continually bitten by the "stemming" that occurs. [...]

So am I.  I completely switched over from "man -k" to an alias
effecting "apropos -l" ("legacy"-mode):

legacy mode is close, but it doesn't print the "context" information (and,
if you use "apropos -l -m" you still don't get context info, but you do get
extra blank lines).

How about
	man -k lfs | grep -B2 '\<lfs'

Loses some of the nice formatting, but seems to do what is needed.

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.

And yes, the '--' separator lines from each chunk of output from grep are undesirable; of course I could remove them with another grep:

	apropos -k lfs | grep -B2 '\<lfs' | grep -v '^--'


This suggests that the "no stem" option could be implemented in man as a
post-process, after the query, with negligible loss of efficiency.

| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |

Home | Main Index | Thread Index | Old Index