sed: 1: "xxx.cfg": command a expects \ followed by text

github上的原文:sed command with -i option failing on Mac, but works on Linux

不是最佳方案,但比较好,-i''可以直接覆盖,不用创建备份。

This works with both GNU and BSD versions of sed:

sed -i'' -e 's/old_link/new_link/g' *

or with backup:

sed -i'.bak' -e 's/old_link/new_link/g' *