簡體   English   中英

我如何告訴wget下載文本文件(在這種情況下),該文本文件在文本文件的中間包含一個特定的字符串

[英]How do I tell wget to download text files (in this case) which contain a specific string in the middle of the text files

我正在參加軟件開發課程,正在嘗試在所有軟件開發人員中實踐“ DRY”原理,因此,為了進行練習,我希望wget下載本文檔中的所有文件(http://fusionplant.com/ archive / textfiles /)目錄,其中包含“令人反感”一詞。

這是其中之一的示例: http : //fusionplant.com/archive/textfiles/gnu_fortune/gnu_fortune_offensive_astrology

有什么方法可以做到這一點? 我想他們會使用正則表達式,但是我在網上找不到足夠可比的示例來完成它。

這是我嘗試使用的命令,這是錯誤的。 甚至沒有關閉,但是這里是:

    wget -A '*offensive*.txt' http://fusionplant.com/archive/textfiles/gnu_fortune

它沒有返回錯誤信息,而是下載了索引文件

wget -A '*offensive*.txt' http://fusionplant.com/archive/textfiles/gnu_fortune
--2012-06-15 11:15:07--  http://fusionplant.com/archive/textfiles/gnu_fortune
Resolving fusionplant.com... 216.254.119.231
Connecting to fusionplant.com|216.254.119.231|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://fusionplant.com/archive/textfiles/gnu_fortune/ [following]
--2012-06-15 11:15:07--  http://fusionplant.com/archive/textfiles/gnu_fortune/
Reusing existing connection to fusionplant.com:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “gnu_fortune”

[  <=>                                  ] 14,576      50.4K/s   in 0.3s    

2012-06-15 11:15:08 (50.4 KB/s) - “gnu_fortune” saved [14576]

你不能這樣做。 您將必須下載文件,然后檢查文件是否包含字符串。 您無法將請求發送到服務器以使其為您完成。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM