sed:-i可能无法在Mac OS X上与stdin一起使用 [英] sed: -i may not be used with stdin on Mac OS X

查看:187
本文介绍了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\n  __attribute__ ((__unused__));\n# endif/"

我收到此错误 sed:-i不能与stdin一起使用

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\n  __attribute__ ((__unused__));\n# endif/" y.tab.c

这篇关于sed:-i可能无法在Mac OS X上与stdin一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆