我对 Sed 一无所知,但需要这个命令(在 Ubuntu 上运行良好)才能在 Mac OSX 上运行:
sed -i "/ $domain .*#drupalpro/d" /etc/hosts
我明白了:
sed: 1: "/etc/hosts": extra characters at the end of h command
最佳答案
Ubuntu 附带 GNU sed
,其中 -i
选项的后缀是可选的。 OS X 附带 BSD sed
,其中后缀是强制性的。试试 sed -i ''
关于linux - 带有 -i 选项的 sed 命令(就地编辑)在 Ubuntu 上运行良好,但在 Mac 上运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16745988/
相关文章:
python - 检测和排除 pandas DataFrame 中的异常值
python - 为什么 Python 中的 @foo.setter 对我不起作用?
python - 导入错误 : No module named PIL
linux - 如何删除 "Argument list too long"时超过 3 天的所有文件?
python - TypeError : sequence item 0: expected str
python - 如何在 Python 中将 RGB 图像转换为灰度图像?