Closed. This question is off-topic. It is not currently accepting answers. Learn more
想改进这个问题吗?Update the question所以堆栈溢出的值小于aa>。
去年关门了。
在Linux中,如何显示每个命令的名称,这些命令的手册页中提到了特定的人?克尼根。
是否可以显示手动命令的作者姓名,请建议?

最佳答案

man man

-K, --global-apropos
              Search for text in all manual  pages.   This  is  a  brute-force
              search,  and is likely to take some time; if you can, you should
              specify a section to reduce the number of pages that need to  be
              searched.   Search terms may be simple strings (the default), or
              regular expressions if the --regex option is used.

所以你只要:
$ man -wK Kernighan
/usr/share/man/man1/pic.1.gz
/usr/share/man/man1/chem.1.gz
/usr/share/man/man1/gawk.1.gz
/usr/share/man/man1/ex.1.gz
/usr/share/man/man1/ex.1.gz
/usr/share/man/man1/makeindex.1.gz
/usr/share/man/man3/Pod::Man.3perl.gz
....

我花了一些时间筛选出作者,我只带了以下内容:
 what=Kernighan;
 man -wK Kernighan |
 while IFS= read -r l; do
      # filter authors section from the manual page
      authors=$(man -P cat "$l" 2>/dev/null | sed '/AUTHORS/,/^[^ ]/!d');
      # if the authors section mentions Kerningham print the page
      if grep "$what" <<<"$authors" >/dev/null; then
           echo "$l";
      fi;
 done

 /usr/share/man/man1/chem.1.gz
 /usr/share/man/man1/gawk.1.gz
 ...

10-08 08:46