【发布时间】:2020-06-15 13:20:34
【问题描述】:
我有以下文件:
cat file.txt
User-agent: *
Disallow: /a-path*
Disallow: /000111/
Disallow: /*/my-path
User-agent: megaindex
Disallow: /
User-agent: DigitalPebble
Disallow: /
User-agent: EISSAB
Disallow: /
User-agent: archive.org_bot
Disallow: /
User-agent: dotbot
Disallow: /
我只需要保留 User-agent:* 块的指令和 Disallow 值,并删除下面的所有行。
所以在这种情况下,只应保留以下内容:
User-agent: *
Disallow: /a-path*
Disallow: /000111/
Disallow: /*/my-path
还有以下要删除的:
User-agent: megaindex
Disallow: /
User-agent: DigitalPebble
Disallow: /
User-agent: EISSAB
Disallow: /
User-agent: archive.org_bot
Disallow: /
User-agent: dotbot
Disallow: /
【问题讨论】:
-
你想保留的总是第一个吗?
-
您对问题的描述与您实际展示的示例不一致。