How to find and replace all occurrences of a string recursively in a directory tree?

前端 未结 8 1581
野性不改
野性不改 2020-12-12 18:01

Using just grep and sed, how do I replace all occurrences of:

a.example.com

with

b.example.com

within a

8条回答
  •  眼角桃花
    2020-12-12 18:36

    Try this command:

    /home/user/ directory - find ./ -type f \
    -exec sed -i -e 's/a.example.com/b.example.com/g' {} \;
    

提交回复
热议问题