开发者

Replace C++ pointer field access symbol to a period, using sed

I'm trying to replace all occurrences of -> with .. I开发者_如何学C've tried the following:

sed -i s/->/./g licensewizard.cpp

But this gives me an error:

sed: -e expression #1, char 3: unterminated `s' command

I'm not sure what's wrong since neither - nor > need to be escaped if I'm not mistaken?


You need to single quote your sed commands so that the shell wont try to interpret any of the chars. In this particular instance, your shell was interpreting the > character to attempt a redirection.

sed -i 's/->/./g' licensewizard.cpp
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜