It seems like you are just trying to join groups of three lines, which you can 
do very easily using this following command:

:g/./j!3

Hope that helps!

Max

> -----Original Message-----
> From: Nikolaos A. Patsopoulos [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 13, 2006 8:48 AM
> To: vim@vim.org
> Subject: vim | reformatting question
>
> Hi,
>
> I'm trying to fix a file in the following format :
>
> 5,329;
> 1999;
> <a> Univ Washington</a>;
> 695;
> 2001;
> NHLBI;
> 684;
> 1998;
> <a> Stanford Univ</a>;
> 3,537;
> 1998;
> La Jolla Inst Allergy & Immunol;
> 3,333;
> 1996;
> <a> BRIGHAM & WOMENS HOSP</a>;
> 2,967;
> 1998;
> <a> Northwestern Univ</a>;
> 2,936;
> 2002;
> <a> NHLBI</a>;
> 2,695;
> 1996;
> <a> ST JUDE CHILDRENS HOSP</a>;
> 2,581;
> 1998;
> <a> Merck Res Labs</a>;
>
> into this:
>
> 5,329;1999;<a> Univ Washington</a>;
> 695;2001;NHLBI;
> 684;1998;<a> Stanford Univ</a>;
> 3,537;1998;La Jolla Inst Allergy & Immunol;
> 3,333;1996;<a> BRIGHAM & WOMENS HOSP</a>;
> etc...
>
> I came up with this but sth is missing...
>
> :%s/\(^\d,\d\d\d;$\|^\d\d\d;$\)\(^\d\d\d\d;$\)\(^\D\+;$\)/\1\2\3

Reply via email to