为什么我无法 grep tmux 手册页中的 join-pane?

mbi*_*ras 0 grep man tmux

如果我输入man tmux/join-pane我会直接转到我正在寻找的子命令:

在此输入图像描述

但如果我 grep 手册页,那么我什么也得不到:

$ man tmux | grep join-pane
$ echo $?
1
Run Code Online (Sandbox Code Playgroud)

如果我尝试一些不同的东西,那么它确实有效:

$ man tmux | grep 'terminal multiplexer'
     tmux -- terminal multiplexer
     tmux is a terminal multiplexer: it enables a number of terminals to be
Run Code Online (Sandbox Code Playgroud)
  • 这里发生了什么?
  • 为什么我无法 grep tmux 手册页中的 join-pane?

有关我的操作系统和我正在使用的命令的一些详细信息:

$ 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
Run Code Online (Sandbox Code Playgroud)

根据关于这是一个终端问题的评论,我尝试了更多一些不起作用的模式:

$ 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
Run Code Online (Sandbox Code Playgroud)

Siv*_*iva 5

尝试这个,

 man tmux | col -b | grep -e 'join-pane'
Run Code Online (Sandbox Code Playgroud)

手册页具有缓冲对象,例如^H通过退格和重划来模拟粗体和下划线字符。

  • col将过滤掉这些缓冲区。

您可以通过将手册页复制到文件中来检查差异。

带缓冲区:

 man tmux > file1
Run Code Online (Sandbox Code Playgroud)

没有缓冲区:

 man tmux | col -b > file2
Run Code Online (Sandbox Code Playgroud)