$wget --output-document=/dev/null http://website.com/file.jpg
Resolving speedtest.sea01.softlayer.com... 67.228.112.250
Connecting to speedtest.sea01.softlayer.com|67.228.112.250|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1986284 (1.9M) [image/jpeg]
Saving to: `/dev/null'
2011-10-02 22:38:04 (337 KB/s) - `/dev/null' saved [1986284/1986284]
一切都在上面工作,但我想知道如何在变量中存储最后一行或通过GREP传递它 – > /((.))/
(我正在尝试解析平均KB / s)
解决方法:
您可以重定向命令的输出.例如:
$wget --output-document=/dev/null http://website.com/file.jpg 2>&1 | tee /tmp/somefile
$tail -n 1 /tmp/somefile