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

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

    You can use awk to solve this as below,

    for file in `find /home/www -type f`
    do
       awk '{gsub(/subdomainA.example.com/,"subdomainB.example.com"); print $0;}' $file > ./tempFile && mv ./tempFile $file;
    done
    

    hope this will help you !!!

提交回复
热议问题