sed -i command for in-place editing to work with both GNU sed and BSD/OSX

后端 未结 7 1049
攒了一身酷
攒了一身酷 2020-11-28 04:09

I\'ve got a makefile (developed for gmake on Linux) that I\'m attempting to port to MacOS, but it seems like sed doesn\'t want to cooperate. What I

相关标签:
7条回答
  • 2020-11-28 04:44

    This isn't quite an answer to the question, but one can get linux-equivalent behavior through

    brew install gnu-sed
    
    # Add to .bashrc / .zshrc
    export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
    

    (previously there was a --with-default-names option to brew install gnu-sed but that has recently been removed)

    0 讨论(0)
提交回复
热议问题