删除wget的逐位日志

删除wget的逐位日志

我有一个 php 脚本,可以生成 wget 文件的 bash 命令。我正在尝试使用以下命令记录 wget 活动:

--directory-prefix='xxx' --append-output='xxx.txt' -c -t0 -S"

但由于以下原因,日志太大:

 0K .......... .......... .......... .......... ..........  0%  110K 14m5s
50K .......... .......... .......... .......... ..........  0%  230K 10m24s
100K .......... .......... .......... .......... ..........  0%  272K 8m49s
150K .......... .......... .......... .......... ..........  0% 41.7K 15m53s
200K .......... .......... .......... .......... ..........  0%  173M 12m42s
.
.
.
92800K .......... .......... .......... .......... .......... 99%  156K 0s
92850K .......... .......... ...                             100%  139K=7m56s

我可以删除上面的输出并让 wget 只得到这个:

Warning: wildcards not supported in HTTP.
--2015-03-14 20:10:22--  xxxx
Resolving xxxx... xxxx
Connecting to xxxx|xxxx|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 401 Unauthorized
  Server: nginx/1.4.4
  Date: Sat, 14 Mar 2015 12:09:58 GMT
  Content-Type: text/html
  Content-Length: 194
  Connection: keep-alive
  WWW-Authenticate: Basic realm="xxxx"
Reusing existing connection to xxxx:80.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx/1.4.4
  Date: Sat, 14 Mar 2015 12:09:58 GMT
  Content-Type: application/octet-stream
  Content-Length: 95102657
  Last-Modified: Sun, 02 Mar 2014 04:54:04 GMT
  Connection: keep-alive
  ETag: "5312b96c-5ab26c1"
  Accept-Ranges: bytes
Length: 95102657 (91M) [application/octet-stream]
Saving to: `xxxx.mkv'
Warning: wildcards not supported in HTTP.
--2015-03-14 20:10:22--  xxxx
Resolving xxxx... xxxx
Connecting to xxxx|xxxx|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 401 Unauthorized
  Server: nginx/1.4.4
  Date: Sat, 14 Mar 2015 12:09:58 GMT
  Content-Type: text/html
  Content-Length: 194
  Connection: keep-alive
  WWW-Authenticate: Basic realm="xxxx"
Reusing existing connection to xxxx:80.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx/1.4.4
  Date: Sat, 14 Mar 2015 12:09:58 GMT
  Content-Type: application/octet-stream
  Content-Length: 95102657
  Last-Modified: Sun, 02 Mar 2014 04:54:04 GMT
  Connection: keep-alive
  ETag: "5312b96c-5ab26c1"
  Accept-Ranges: bytes
Length: 95102657 (91M) [application/octet-stream]
Saving to: `xxxx.mkv'

2015-03-14 20:18:19 (195 KB/s) - `xxxx.mkv' saved [95102657/95102657]

如果我只对真正的细节感兴趣,那么仅仅因为这个日志,我就消耗了太多的空间。

答案1

您可以使用以下命令关闭大量输出-nv选项。如果这对您来说太冗长,您可以使用以下命令调整进度报告--progress选项,但我认为你不能完全删除它。报告dot:mega样式每 64kB 生成一个点(而不是默认情况下每 1kB 生成一个点)。

wget --progress=dot:mega …

最近的版本也支持dot:giga(每 1MB 一个点)。

相关内容