If I do man bash | grep read -c the output is 218. But I want to search only for colored regex in man. I still haven't find an approach. Any hint is welcome.
Asked
Active
Viewed 193 times
0
Jeff Schaller
- 66,199
- 35
- 114
- 250
John Goofy
- 911
- 1
- 6
- 17
-
I take it you’re carefully avoiding the hammer there @Stéphane ;-). – Stephen Kitt Oct 30 '18 at 15:44
-
@StephenKitt, yes, the other one is for `less`, this one for `grep`, so while some of the answers there apply here, not all do, and some man implementations stop outputting in colour when piped and there way be different approaches that one could use for `grep` – Stéphane Chazelas Oct 30 '18 at 15:47
1 Answers
0
With the man implementation from man-db
MAN_KEEP_FORMATTING=1 man bash | grep -c $'r\bre\bea\bad\bd'
See
- Grep: unexpected results when searching for words in heading from man page for the background and
- How can I search for bolded or underlined text? for more options.
Stéphane Chazelas
- 522,931
- 91
- 1,010
- 1,501