sed command with -i option failing on Mac, but works on Linux

前端 未结 12 1868
情歌与酒
情歌与酒 2020-11-22 05:04

I\'ve successfully used the following sed command to search/replace text in Linux:

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

However,

12条回答
  •  隐瞒了意图╮
    2020-11-22 05:54

    Or, you can install the GNU version of sed in your Mac, called gsed, and use it using the standard Linux syntax.

    For that, install gsed using ports (if you don't have it, get it at http://www.macports.org/) by running sudo port install gsed. Then, you can run sed -i 's/old_link/new_link/g' *

提交回复
热议问题