首页 > 其他分享 >MAC执行sed命令报“command c expects \ followed by text”错误解决办法

MAC执行sed命令报“command c expects \ followed by text”错误解决办法

时间:2022-12-12 20:13:26浏览次数:47  
标签:followed gnu text expects sed command

背景:

mac 系统, 想对文件进行内容替换,
执行 sed -i xxxx 语句的时候,提示“command c expects \ followed by text”

查了一下,大概是这个指令在 mac 下不太好使吧。得换个语句。

解决方案:

brew install gnu-sed
alias sed=gsed (这一句可要,可不要)

如果只安装了 gnu-sed,那就得用 gnu-sed -i xxxx 来替换了。
如果再执行了 alias sed = gsed ,那原语句直接再执行一次就行。

标签:followed,gnu,text,expects,sed,command
From: https://www.cnblogs.com/aaacarrot/p/16976974.html

相关文章