"G. Branden Robinson" <[email protected]> writes:

Looks good to me. Here it is as a shell function you can put in your
.bashrc (or startup file for some other POSIX shell).

    # Search for a word in a given man page.
    #
# Equivalent examples (if using man-db man): tagman am 7 groff # tagman am 'groff(7)' # tagman am -s 7 groff
    tagman () {
      word=$1
      shift
man "$@" | "${PAGER:-less}" -c '+/[^a-zA-Z0-9]'"$word"'[^a-zA-Z0-9]'
    }

As a data point, this nifty function overall worked for me with mandoc
man(1) as well, although:

* mandoc man(1) doesn't like 'groff(7)' as an argument, resulting in
 a "No entry for groff(7) in the manual" error. (`man 7 groff`
 works fine.)

* i've been trialing using most(1) instead of less(1), and the
 function doesn't work with the former.

Thanks!


Alexis.
(flexibeast)

Reply via email to