我想只閱讀手冊頁中我正在尋找的部分。使用終端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