How to do a recursive find/replace of a string with awk or sed?

后端 未结 30 2391
盖世英雄少女心
盖世英雄少女心 2020-11-22 06:39

How do I find and replace every occurrence of:

subdomainA.example.com

with

subdomainB.example.com

in eve

30条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 07:26

    For replace all occurrences in a git repository you can use:

    git ls-files -z | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'
    

    See List files in local git repo? for other options to list all files in a repository. The -z options tells git to separate the file names with a zero byte, which assures that xargs (with the option -0) can separate filenames, even if they contain spaces or whatnot.

提交回复
热议问题