我正在尝试将wget结果STDOUT到文本文件,只是想在结果中获取进度条的最后一行。
以下是我的结果示例。
--2018-02-01 11:16:45-- http://www.stackoverflow.com/
Resolving www.stackoverflow.com (www.stackoverflow.com)... 151.101.1.69, 151.101.65.69, 151.101.129.69, ...
Connecting to www.stackoverflow.com (www.stackoverflow.com)|151.101.1.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://stackoverflow.com/ [following]
--2018-02-01 11:16:45-- https://stackoverflow.com/
Resolving stackoverflow.com (stackoverflow.com)... 151.101.1.69, 151.101.65.69, 151.101.129.69, ...
Connecting to stackoverflow.com (stackoverflow.com)|151.101.1.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 254160 (248K) [text/html]
Saving to: ‘/dev/null’
/dev/null 0%[ ] 0 --.-KB/s
/dev/null 20%[===> ] 50.27K 248KB/s
/dev/null 75%[==============> ] 186.90K 464KB/s
/dev/null 100%[===================>] 248.20K 514KB/s in 0.5s
2018-02-01 11:16:46 (514 KB/s) - ‘/dev/null’ saved [254160/254160]
这就是我得到的方式
wget -O /dev/null --progress=bar:force www.stackoverflow.com 2>> log_browse.txt
如何在仅显示此文件的文件中输出?
--2018-02-01 11:16:45-- http://www.stackoverflow.com/
Resolving www.stackoverflow.com (www.stackoverflow.com)... 151.101.1.69, 151.101.65.69, 151.101.129.69, ...
Connecting to www.stackoverflow.com (www.stackoverflow.com)|151.101.1.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://stackoverflow.com/ [following]
--2018-02-01 11:16:45-- https://stackoverflow.com/
Resolving stackoverflow.com (stackoverflow.com)... 151.101.1.69, 151.101.65.69, 151.101.129.69, ...
Connecting to stackoverflow.com (stackoverflow.com)|151.101.1.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 254160 (248K) [text/html]
Saving to: ‘/dev/null’
/dev/null 100%[===================>] 248.20K 514KB/s in 0.5s
2018-02-01 11:16:46 (514 KB/s) - ‘/dev/null’ saved [254160/254160]
进展的最后一行......