linux & mac 区别
sed -i 在 Linux 及 MacOS 下的用法不同
man sed in Linux
man sed in Linux -i[SUFFIX], –in-place[=SUFFIX] edit files in place (makes backup if SUFFIX supplied)
man sed in MacOS
-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 cor- ruption or partial content in situations where disk space is exhausted, etc.
举例子
sed -i 's/oldstring/newstring/g' full-path-file
sed -i '' 's/oldstring/newstring/g' full-path-file
- -i 参数在centOS下是可选的,mcsOS下是必选的