0

This question already has an answer here:

If I type man tmux then /join-pane I go right to the subcommand I'm looking for:

enter image description here

But if I grep the man page then I get nothing:

$ man tmux | grep join-pane
$ echo $?
1

If I try something different then it does work:

$ man tmux | grep 'terminal multiplexer'
     tmux -- terminal multiplexer
     tmux is a terminal multiplexer: it enables a number of terminals to be
  • What is going on here?
  • Why can't I grep the tmux man page for join-pane?

Some details about my operating system and the commands I'm using:

$ uname -a
Darwin home.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
$ grep --version
grep (BSD grep) 2.5.1-FreeBSD
$ man --version
man, version 1.6c
$ tmux -V
tmux 2.7

As per a comment about this being a terminal issue I tried some more patterns that didn't work:

$ man tmux | grep join\-pane
$ man tmux | grep "join-pane"
$ man tmux | grep 'join-pane'
$ man tmux | grep 'join\-pane'
$ man tmux | grep "join\-pane"
$ man tmux | grep -e join-pane

marked as duplicate by Stéphane Chazelas grep Aug 1 '18 at 6:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I guessed your terminal issue. did you try with "join-pane" or join\-pane? it worked for me as well – Hossein Vatani Aug 1 '18 at 4:44
  • 1
    grep --version? Cannot reproduce this with grep (GNU grep) 2.25 and man 2.7.5. Did you try grep -e join-pane yet? – Zeta Aug 1 '18 at 4:49
4

Try this,

 man tmux | col -b | grep -e 'join-pane'

man pages have buffer objects like ^H to emulate bold and underlined characters by backspacing and overstriking.

  • col will filter out those buffers.

you can check the difference by copying the man page into a file.

with buffer:

 man tmux > file1

without buffers:

 man tmux | col -b > file2

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