报错 sed: 1: extra characters at the end of d command

错误描述

在macOS 上执行sed命令,报错

sed -i 's/book/books/g' demo.txt
sed: 1: extra characters at the end of d command

解决方法

原因是mac的和linux写法不一样

# linux
sed -i 's/book/books/g' demo.txt

# mac
sed -i '' 's/book/books/g' demo.txt

参考
mac 执行sed -i指令时,总是出现extra characters at the end of command

猜你喜欢

转载自blog.csdn.net/mouday/article/details/128616744
今日推荐