我想只阅读手册页中我正在寻找的部分。使用终端man命令阅读手册页中的章节
例如,要在man
手册页只读的-k
的部分,我可以使用
man man | grep -E '(-k)'
结果:
man -k [apropos options] regexp ...
man -k printf
-k, --apropos
which in turn overrides the $PAGER environment variable. It is not used in conjunction with -f or -k.
结果是不好的,因为不是所有的章节我需要。
所以目前我使用:
man man | grep -E '(-k|'')'
结果是所有的文字,但在红色标注-k
。
我的问题是我怎么能得到类似的输出:
man -k [apropos options] regexp ...
man -k printf
Search the short descriptions and manual page names for the keyword printf as regular expression. Print out any matches.
Equivalent to apropos printf.
-k, --apropos
Equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1)
for details.
是否importen你,得到与-k所有线路,包括对手册页的开头概述的例子,或者是详细参数说明够吗? – sebkrueger
有人提供'男人| sed'/ -k /,/^$ /!d''但是对于'-r' – Benny
工作不正常因为'-r'的附带匹配就像'--regex' ...你可以通过指定将是空格或逗号的下一个字符'man man | sed'/ -k [,] /,/^$ /!d''但显然停在空行并不是干净地给你你想要的东西:S – Zanna