开发者

How to delete text delimited by { and }

I am new to UNIX programming and had the following problem with UNIX vi editor.

Can you please tell me the UNIX command required to delete text delimited by { and } where both characters occur after the current 开发者_如何转开发cursor position. Thanks.


If you're on the same line :

f{d%

f{ moves you to the next { character d% deletes everything to the matching bracket

If you're on a different line, use /{ to search for that character

And if you want to delete ALL text delimited like this :

:%s/{.*}//g

(replaces all instances of anything between brackets with nothing)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜