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

后端 未结 30 2094
盖世英雄少女心
盖世英雄少女心 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:27

    Note: Do not run this command on a folder including a git repo - changes to .git could corrupt your git index.

    find /home/www/ -type f -exec \
        sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g' {} +
    

    Compared to other answers here, this is simpler than most and uses sed instead of perl, which is what the original question asked for.

提交回复
热议问题