sed:1:" ./。classpath":无效的命令代码。错误。问题是什么?

时间:2016-02-02 00:34:28

标签: java regex git bash sed

我在图片中收到错误。我有一个名为.classpath的文件。根本原因是什么?

enter image description here

dbao@bothlower-lm 13:45:34 -/git/profile_load_generator $find . -path ./ .git -prune -o -type f -print0 l xargs -0 sed -i 's/yahoo/zbipp/g' - sed: 1 "-":./.classpath": invalid command code.

dbao@bothlower-lm 13:47:16 -/git/profile_load_generator $find . -path ./ .git -prune -o -type f -print0 l xargs -0 sed -i 's/yahoo/zbipp/g' - sed: 1 "-":./.classpath": invalid command code.

dbao@bothlower-lm 17:40:16 -/git/profile_load_generator $ ls
  

bin conf pkg pom.xml src

dbao@bothlower-lm 17:40:16 -/git/profile_load_generator $ ls -l ./.classpath 
  

-rw-r - r-- 1 dbao Y \ Domain Users 998 Jan 18 17:18 ./.classpath

1 个答案:

答案 0 :(得分:1)

sed - 选项-i在其 BSD-version 中需要一个参数(而不是GNU版本),这是先前创建的备份文件的扩展名就地编辑文件。如果您不需要,请通过指定-i ""

将其留空
find . -path ./ .git -prune -o -type f -print0 | xargs -0 sed -i "" 's/yahoo/zbipp/g'

发生错误,因为's/yahoo/zbipp/g'被视为-i的参数,然后第一个文件名的第一个字符被解析为命令代码(通常是s,但是那么无效)