sed: -i 不能与 Mac OS X 上的 stdin 一起使用 [英] sed: -i may not be used with stdin on Mac OS X
本文介绍了sed: -i 不能与 Mac OS X 上的 stdin 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的项目中使用了野牛解析器.当我运行以下命令时:
I am using a bison parser in my project. When I run the following command:
sed -i y.tab.c -e "s/ __attribute__ ((__unused__))$/# ifndef __cplusplus
__attribute__ ((__unused__));
# endif/"
我收到此错误sed: -i 不能与标准输入一起使用
I get this error sed: -i may not be used with stdin
该命令在 linux 机器上运行良好.我使用的是 Mac OS X 10.9.它仅在 mac os x 上引发错误.我不知道为什么.任何人都可以帮忙吗?
The command works fine in linux machines. I am using Mac OS X 10.9. It throws an error only on mac os x. I am not sure why. Can anyone help?
谢谢
推荐答案
需要把输入文件作为最后一个参数.
You need to put the input file as the last parameter.
sed -i -e "s/ __attribute__ ((__unused__))$/# ifndef __cplusplus
__attribute__ ((__unused__));
# endif/" y.tab.c
这篇关于sed: -i 不能与 Mac OS X 上的 stdin 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文