News for hackers. Stuff that matters.
Re:12 Factor CLI Apps by azernik on Tuesday October 09, 2018 @06:32AM (#18174720)
If you're already piping to less, just use its search functionality; type '/', the regexp, and then enter.
Re:12 Factor CLI Apps by pdpi on Tuesday October 09, 2018 @06:44AM (#18174785)
For that, you might as well just use the regex functionality in man itself too. But that misses the point.

The goal of grepping in that snippet is that you're `less `ing through precisely the parts that matter, and no more, rather than wading through the whole man page, and you're using -C to control how much context you (think you) need around the search results. This is a much better setup for skimming through potential hits than going through the man page wall of text.

Re:12 Factor CLI Apps by azernik on Tuesday October 09, 2018 @10:06AM (#18176066)
'man' has no regex functionality; on most Unix systems, it just uses 'less' as its pager.
Re:12 Factor CLI Apps by pdpi on Tuesday October 09, 2018 @10:23AM (#18176200)
sure, which means that it inherits regex support via less. You either have it on both, or neither.
Re:12 Factor CLI Apps by larkeith on Tuesday October 09, 2018 @06:48AM (#18174809)
IIRC you don't need to pipe to less at all for that - man already supports it. grep -C gives a good summary of the various options, then you can just pull up the man page and use that selfsame search to get details that might've been cut off.
Re:12 Factor CLI Apps by mrcarrot on Tuesday October 09, 2018 @06:45AM (#18174793)
You can also do that directly in 'man'.
Re:12 Factor CLI Apps by JdeBP on Tuesday October 09, 2018 @09:33AM (#18175802)
No. All three of the responders so far have implied that this functionality is in man. It is not. It's in the pager that man invokes; ironically often, but not necessarily always, that very same less program.