Grep 使用wget从一个站点获取类似链接

Grep 使用wget从一个站点获取类似链接,grep,wget,Grep,Wget,我有一个网站()有很多这样的链接。如何使用wget对文件的所有类似链接进行爬网和grep <a href="/user/333333/follow_user" class="btn" rel="nofollow">Follow</a> 您可能希望使用wget的--accept regex选项,而不是通过grep管道: wget -r --accept-regex '['"'"'"][^"'"'"']*/follow_user['"'"'"]' http://a-site

我有一个网站()有很多这样的链接。如何使用wget对文件的所有类似链接进行爬网和grep

<a href="/user/333333/follow_user" class="btn" rel="nofollow">Follow</a>

您可能希望使用
wget
--accept regex
选项,而不是通过
grep
管道:

wget -r --accept-regex '['"'"'"][^"'"'"']*/follow_user['"'"'"]' http://a-site.com

(未经测试,正则表达式可能需要调整或指定
--regex type
(请参见
man wget
),当然还需要添加其他您认为有用的选项)。

交叉发布->请删除此选项或您在U&L上发布的选项。不鼓励在多个SE站点上发布相同的Q。哇。我不知道wget有这个选择。美好的
wget -r --accept-regex '['"'"'"][^"'"'"']*/follow_user['"'"'"]' http://a-site.com