Logs

刪除 wget 的每比特日誌

  • April 6, 2019

我有一個 php 腳本,它可以生成 bash 命令到 wget 文件。我正在嘗試使用以下方法記錄 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]

如果我只對真實的細節感興趣,我只是因為這個日誌而消耗了太多的空間。

-nv您可以使用該選項關閉大量輸出。如果這對您來說過於冗長,您可以使用--progress選項調整進度報告,但我認為您不能完全刪除它。dot:mega報告樣式每 64kB 生成一個點(而不是預設的每 1kB 一個點)。

wget --progress=dot:mega …

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

引用自:https://unix.stackexchange.com/questions/190151