In vim, how can I run the following logic over my file:
If the line
nnot end with a semicolon, concatenate linesnandn + 1.
I have files which have broken SQL statements:
broken version
select * from tab1;
select col4, col5 from
tab5;
insert into
tab6 values(
2, 4);
required version
select * from tab1;
select col4, col5 from tab5;
insert into tab6 values(2, 4);
You may have to run it several times.
EDIT: Here is a solution that solves lines split on multiple (>2) lines:
Note: Empty lines are kept, but trimmed, thanks to the ^\s*$