extra characters at the end of g command


使用sed命令替换文本内容的时候出现报错,如下

 1 sed -i 's/HostName/#HostName/g' /Users/gwd/.ssh/config 

sed: 1: "/Users/gwd/.ssh/config": extra characters at the end of g command

报错“sed: 1: "/Users/gwd/.ssh/config": extra characters at the end of g command”,原因在于在OS X需要显式指定扩展名,解决方案是设置一个空字符串,即执行以下命令即可

 1 sed -i '' 's/HostName/#HostName/g' /Users/gwd/.ssh/config 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM