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

简介: 报错 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


相关文章
|
17天前
|
Perl
在 `awk` 命令中,`BEGIN { commands }`
在 `awk` 命令中,`BEGIN { commands }`
13 2
|
17天前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
|
9月前
|
Java
解决Command line is too long. Shorten command line for ServiceStarter or also for Application报错
解决Command line is too long. Shorten command line for ServiceStarter or also for Application报错
66 0
|
12月前
Newline required at end of file but not found.
Newline required at end of file but not found.
115 0
Newline required at end of file but not found.
sed: 1: “s/os.remove(“/xx/xxx. ...“: invalid command code f
sed: 1: “s/os.remove(“/xx/xxx. ...“: invalid command code f
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
185 0
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
116 0
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
Command line is too long. Shorten command line for AppWebStarter or...(已解决)
找到你项目中 .idea/workspace.xml文件 找到 < component name=“PropertiesComponent” > 在标签内部加上这句
146 0
Command line is too long. Shorten command line for AppWebStarter or...(已解决)