VIM ..根据正则表达式划分多行

前端之家收集整理的这篇文章主要介绍了VIM ..根据正则表达式划分多行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的情况我有很多sql行,如下所示.
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah
SET IDENTITY_INSERT blah
DELETE FROM blah

我想用VIM重新排列它

SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
SET IDENTITY_INSERT blah
DELETE FROM blah
DELETE FROM blah
DELETE FROM blah

现在我知道我可以写一个简单的python脚本来快速完成这个,但我正在努力提高我的VIM技能.

你可以使用g命令:
:g/^DELETE/m$

这会将(m)以DELETE开头的所有行移动到文件末尾($).

猜你在找的Bash相关文章