更新时间:2023-01-13 10:07:55
如果您使用的是 OS X,这可能与 sed 命令无关.在 sed
的 OSX 版本上,-i
选项需要一个 extension
参数,因此您的命令实际上被解析为 extension
参数,文件路径被解释为命令代码.
If you are on a OS X, this probably has nothing to do with the sed command. On the OSX version of sed
, the -i
option expects an extension
argument so your command is actually parsed as the extension
argument and the file path is interpreted as the command code.
尝试显式添加 -e
参数并将 ''
作为参数提供给 -i
:
Try adding the -e
argument explicitly and giving ''
as argument to -i
:
find ./ -type f -exec sed -i '' -e "s/192.168.20.1/new.domain.com/" {} ;
请参阅此.