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

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

    I just needed this and was not happy with the speed of the available examples. So I came up with my own:

    cd /var/www && ack-grep -l --print0 subdomainA.example.com | xargs -0 perl -i.bak -pe 's/subdomainA\.example\.com/subdomainB.example.com/g'
    

    Ack-grep is very efficient on finding relevant files. This command replaced ~145 000 files with a breeze whereas others took so long I couldn't wait until they finish.

提交回复
热议问题