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.

  • 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

With the man implementation from man-db

MAN_KEEP_FORMATTING=1 man bash | grep -c $'r\bre\bea\bad\bd'


Not the answer you're looking for? Browse other questions tagged or ask your own question.