报错 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


相关文章
|
9月前
|
Perl
在 `awk` 命令中,`BEGIN { commands }`
在 `awk` 命令中,`BEGIN { commands }`
52 2
|
9月前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
Newline required at end of file but not found.
Newline required at end of file but not found.
215 0
Newline required at end of file but not found.
checking build system type... ./config.guess: unable to guess system type/you must specify one
checking build system type... ./config.guess: unable to guess system type/you must specify one
180 0
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
运行 ‘ApiApplication‘ 出错: Command line is too long. Shorten command line for ShopApiApplication or
255 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
170 0
Error running 'XXXApplication': Command line is too long. Shorten command line forXXX
find: missing argument to `-exec‘ 已解决
find: missing argument to `-exec‘ 已解决
699 0
find: missing argument to `-exec‘ 已解决
Command line is too long. Shorten command line for AppWebStarter or...(已解决)
找到你项目中 .idea/workspace.xml文件 找到 < component name=“PropertiesComponent” > 在标签内部加上这句
177 0
Command line is too long. Shorten command line for AppWebStarter or...(已解决)
find: missing argument to `-exec&#39;
今天使用find命令查找删除文件时,遇到下面错误,这个是因为在{}和\之间必须要有空格,否则会报上面的错。 以前都没有注意到这个细节,特此记录一下。   [root@DB-Server full]#  find  .
1462 0