sed命令在Mac中不起作用 [英] sed command not working in mac

查看:262
本文介绍了sed命令在Mac中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下sed命令在我的狮子Mac上不起作用.

Following sed command is not working on my lion mac.

find . -type f -exec sed -i 's/user_dashboard/user/g' {} \;

我收到此错误

sed: 1: "./vendor/assets/javascr ...": invalid command code .

推荐答案

sed的OSX版本与大多数Linux系统中的版本不同.

The OSX version of sed is not the same as those found in most Linux systems.

它扩展了-i选项,使您有机会保存具有其他扩展名的文件,但是需要输入该扩展名.

It extends the -i option to give you the opportunity save a file with a different extension, but requires input for that extension.

如果只想覆盖原位文件,则需要使用sed -i "" ...sedCmd.... fileName重命名原位文件.

If you just want to overwrite the file in place, you need to use sed -i "" ...sedCmd.... fileName to rename your file in-place.

每个@JamesMcMahon的评论,请参见 OSX/BSD sed的完整文档.

Per @JamesMcMahon 's comment, see here for the full doc for OSX/BSD sed.

我希望这会有所帮助.

这篇关于sed命令在Mac中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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