[英]Shell Find and Replace Domain in all files and its folder, sub folder
I have a domain 我有一个域
https://account.oldomain.com
I now migrate to a new domain 我现在迁移到新域
https://account.newdomain.com
I wanna replace all occurance of account.olddomain.com with account.newdomain.com 我想将account.olddomain.com的所有情况替换为account.newdomain.com
How do I do it 我该怎么做
I know I can use something like 我知道我可以使用类似
sed -i 's/account.oldomain.com/account.newdomain.com/g' /hello
But sed: couldn't edit /hello: not a regular file 但是sed:无法编辑/ hello:不是常规文件
How do I replace all the files inside current directory, and its directory , sub directory of directory , as in all the files and folders of the current folder 如何替换当前目录中的所有文件及其目录,目录的子目录,就像在当前文件夹的所有文件和文件夹中一样
with containing the text account.oldomain.com with account.newdomain.com
Thanks!! 谢谢!!
try: 尝试:
find /hello -type f|xargs sed -i 's#\(account[.]\)oldomain\([.]com\)#\1newdomain\2#g'
I change your .
我换你的
.
-> [.]
, to match exactly dot
, not any char. ->
[.]
,以完全匹配dot
,而不是任何字符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.