在mac osx lion中sed来进行文件内容的替换操作,使用命令为:
sed -i 's/oldstring/newstring/g' full-path-file
执行后提示出错,错误信息为:“sed: 1: command a expects \ followed by text”,但是相同的命令拿到centos下确能执行成功。 使用man查看命令的参数详细说明,两个系统下对参数“i”的要求不一样。
mac osx中为:
-i extension
Edit files in-place, saving backups with the specified extension. If a zero-length extension is given, no backup will be saved.
It is not recommended to give a zero-length extension when in-place editing files, as you risk corruption or partial content in situations where disk space is exhausted, etc.
centos中为:
-i[SUFFIX], --in-place[=SUFFIX]
edit files in