Redirect output from sed 's/c/d/' myFile to myFile

后端 未结 10 862
暖寄归人
暖寄归人 2020-12-09 10:15

I am using sed in a script to do a replace and I want to have the replaced file overwrite the file. Normally I think that you would use this:

% sed -i \'s/c         


        
10条回答
  •  无人及你
    2020-12-09 11:04

    You can use sponge from the moreutils.

    sed "s/cat/dog/" manipulate | sponge manipulate
    

提交回复
热议问题