我有一个这样的文件,我想用sed
来处理。
// file.js
return foo.quux();
运行以下内容:
$ sed -i "s/foo\.(?!bar|baz)/qux\./g" file.js
预期要替换的文件,例如:
// file.js
return qux.quux();
但是bash
不断告诉我:
bash: !bar: event not found
重写为:
$ sed -i "s/foo\.(?'!'bar|baz)/qux\./g" file.js
但是bash
仍要出于自己的目的使用感叹号:
bash: !: event not found
在没有sed
参与的情况下,有人对如何制作bash
的排除有任何提示吗?