Shell查找和替换域在所有文件及其文件夹,子文件夹



我有一个域名

https://account.oldomain.com

我现在迁移到一个新的域

https://account.newdomain.com

我想把所有出现的account.olddomain.com替换为account.newdomain.com

我该怎么做

我知道我可以用

sed -i 's/account.oldomain.com/account.newdomain.com/g' /hello

但是sed:无法编辑/hello: not a regular file

如何替换当前目录下的所有文件,以及它的目录,目录的子目录,就像在当前文件夹下的所有文件和文件夹

with containing the text account.oldomain.com with account.newdomain.com

谢谢! !

try:

find /hello -type f|xargs sed -i 's#(account[.])oldomain([.]com)#1newdomain2#g' 

我改变你的. -> [.],以完全匹配dot,而不是任何字符。

最新更新