代码之家  ›  专栏  ›  技术社区  ›  gnome

查找/替换网站所有页面中的链接

  •  1
  • gnome  · 技术社区  · 15 年前

    在网站的所有页面中查找和替换链接的想法/建议,以及使用Dreamweaver(ick)不是一个选择。网站由100多个静态页面组成。

    3 回复  |  直到 15 年前
        1
  •  1
  •   EricR    15 年前

    在UNIX中,VIM可以选择这样做。

    vim -c "argdo %s/http:\\site.com\/pageA/http:\\site2.com\/pageB/ge | update" *.html
    
        2
  •  0
  •   Pat    15 年前

    像这样的东西怎么样 TextPad Notepad++ ?您可以打开所有HTML文件,然后在所有打开的文档中查找/替换。

        3
  •  0
  •   Stephen P    15 年前

    在Linux/Unix或Cygwin(或类似软件)中

    $ find topdir -name \*.html -print0 | 
       xargs -0 sed --in-place
       -e 's~http://foo\.com/this/that\.html~http://foo.com/other/location/newfile.html~g'
    

    (为了可读性而换行)

    在目录“topdir”下编辑所有文件,将“/this/that.html”url替换为“/other/location/newfile.html”url。