Answers:
您可以将联机帮助页重定向到awk
该部分并进行扩展:
man wget | awk '/^ *-b *.*$/,/^$/{print}'
-b
--background
Go to background immediately after startup. If no output file is specified via the -o, output is redirected to wget-log.
那部分是介于-b
和空行之间的所有内容。
{print}
可以省略
GNU Awk 4.0.1(Ubuntu)
,GNU Awk 3.1.7(CentOS)
和awk version 20070501(OS X)
,但只工作4.0.1
。
.*$
也可以省略
我使用以下脚本连接到explainshell.com。我前一段时间从reddit复制了它:
#!/bin/bash
cmd=$1
shift
args=$*
args=${args/ /+}
w3m -dump "http://explainshell.com/explain/$cmd?args=$args"
我给它起了名字,rman
然后放进了它$PATH
。用途wget -b
:
$ rman wget -b
[logo]
• about
•
• [ ]
wget(1) -b
The non-interactive network downloader
-b
--background
Go to background immediately after startup. If no output file is specified via the -o, output is
redirected to wget-log.
source manpages: wget
您可以对此脚本进行一些调整,以免在一开始就显示垃圾。
编辑:我从这里得到的。感谢作者!
或者,如果您grep
是GNU grep
,则可以按以下方式使用它:
man wget | grep -EA3 '^ *-b'
其中-A
(GNU扩展名)用于匹配行(此处3
)后的打印行数。您可以使用适当的数字进行完整描述。
例:
$ man wget | grep -EA3 '^ *-b'
-b
--background
Go to background immediately after startup. If no output file is specified via the -o, output is
redirected to wget-log.
$ man grep | grep -EA3 '^ *-A'
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a line containing a group separator
(--) between contiguous groups of matches. With the -o or --only-matching option, this has no effect
and a warning is given.