微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 有可能抓住wget的最后一行吗?

$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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐