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

前端 未结 12 2201
情歌与酒
情歌与酒 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 06:09

    I believe on OS X when you use -i an extension for the backup files is required. Try:

    sed -i .bak 's/hello/gbye/g' *
    

    Using GNU sed the extension is optional.

提交回复
热议问题