【发布时间】:2019-01-04 21:29:15
【问题描述】:
假设我有一个这样的站点地图文件:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.sampledomain.com/foo.html</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://www.anotherdomain.nl/hello.html</loc>
<changefreq>weekly</changefreq>
<priority>0.3</priority>
</url>
...
</urlset>
我想将所有 URL(未硬编码为 www.sampledomain.com 和 www.anotherdomain.nl)替换为 www.mynewwebsite.org ,无需更改文件夹/页面路径。
这可以使用 bash 吗?
编辑: 期望的输出:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.mynewwebsite.org/foo.html</loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://www.mynewwebsite.org/hello.html</loc>
<changefreq>weekly</changefreq>
<priority>0.3</priority>
</url>
...
</urlset>
【问题讨论】:
-
你能举个例子吗?