Full Text Search the manpages.

1 Problem is the complex markup and special characters. I'd personally rather see plain text files. Problem solved. You also don't have to scroll 10K lines to find 1 piece of information. (Try find sh file operators as example)
 
I use textproc/ugrep, mostly for grep(1)ing through man pages and FreeBSD source code. It's very fast and option rich.

A comparison in time (slowest to fastest) and printed content.

Code:
 % \time -h zgrep with /usr/share/man/man*/*
Rich (BB code):
[cut]
/usr/share/man/man9/zone.9.gz:.\" Redistribution and use in source and binary forms, with or without
/usr/share/man/man9/zone.9.gz:.\"    documentation and/or other materials provided with the distribution.
/usr/share/man/man9/zone.9.gz:Zones maintain per-CPU caches with linear scalability on SMP
/usr/share/man/man9/zone.9.gz:initialize and destroy a mutex contained within an item.
/usr/share/man/man9/zone.9.gz:/* do something with foo_pcpu */
/usr/share/man/man9/zone.9.gz:Otherwise, by default, book-keeping of items within a slab may be done in the
/usr/share/man/man9/zone.9.gz:method with
/usr/share/man/man9/zone.9.gz:A zone with
/usr/share/man/man9/zone.9.gz:An allocator function will be supplied with
/usr/share/man/man9/zone.9.gz:between pages with contiguous physical addresses.
/usr/share/man/man9/zone.9.gz:with a pointer to that zone and set the
/usr/share/man/man9/zone.9.gz:with a pointer to the zone and a pointer to the item.
/usr/share/man/man9/zone.9.gz:a zone created with
/usr/share/man/man9/zone.9.gz:Note that slab allocation is performed with the
/usr/share/man/man9/zone.9.gz:This is useful if memory with special constraints such as attributes,
/usr/share/man/man9/zone.9.gz:On systems with more than one CPU it may not be possible to allocate
/usr/share/man/man9/zone.9.gz:The function will be called with the zone locked.
/usr/share/man/man9/zone.9.gz:structure with a UMA zone.
/usr/share/man/man9/zone.9.gz:The effect is similar to creating a zone with the
/usr/share/man/man9/zpfind.9.gz:.\" Redistribution and use in source and binary forms, with or without
/usr/share/man/man9/zpfind.9.gz:.\"    documentation and/or other materials provided with the distribution.
    14.51s real        7.03s user        16.40s sys

Code:
 % \time -h  ugrep   -Irzw  with  /usr/share/man/
ugrep.png


Impressive 103765 lines in 0.25s (on NVMe hardware), clearly arranged, line number, search pattern highlighted by default. It has also a TUI (-Q option), and a lot of features (see projects Github page).
Rich (BB code):
 % ugrep --pager=cat -Irwz with /usr/share/man | wc -l
  103765

Note: For some reason, newer versions of ugrep don't respect the $PAGER environment less(1), default on FreeBSD, it must be set, i.e. as an alias ug --pager=less.
 
Thanks, more interesting ugrep(1) info at https://ugrep.com/ & ugrep wiki (with article & video).

EDIT: --pager should start $PAGER #286 seems relevant.
My guess is that your version of ugrep doesn't call less at all (when you expected it would) or doesn't call less -R, when just the pager option is specified. With the examples below it calls less -R, where I have not specified or set -R


Note: For some reason, newer versions of ugrep don't respect the $PAGER environment less(1), default on FreeBSD, it must be set, i.e. as an alias ug --pager=less
I did look at that, and found some strange behaviour, can't remember and didn't investigate thouroughly.
However, now (on latest ports/package branch, just did a pkg upgrade) it works as advertised: i.e. respects $PAGER (switched to less also)—I didn't format colors ;):
Rich (BB code):
[0] # ugrep --version
ugrep 6.5.0 amd64-portbld-freebsd14.0 (no sse2!); -P:pcre2jit; -z:zlib,bzip2,lzma,lz4,zstd,brotli,bzip3,7z,tar/pax/cpio/zip
License: BSD-3-Clause; ugrep user manual: <https://ugrep.com>
Written by Robert van Engelen and others: <https://github.com/Genivia/ugrep>
Ugrep utilizes the RE/flex regex library: <https://github.com/Genivia/RE-flex>
[1] # echo $PAGER
less
[2] # ugrep --pager -Irzw  with  /usr/share/man/          <-- uses less
/usr/share/man/man1/CC.1.gz
    49: Typically you do not need to interact with the driver, but you
 [...]
/usr/share/man/man1/Mail.1.gz
     4: .\" Redistribution and use in source and binary forms, with or without
 [...]
:

I also like using the command ug, for example:
Rich (BB code):
[0] # cat ~/.ugrep
pager
[1] # ug  -Irzw  with  /usr/share/man/
/usr/share/man/man1/CC.1.gz
   [...]
:
 
Last edited:
Back
Top