Tuesday, December 15, 2009

Rectify some bad csv

Hi,


I would like to correct some bad lines in a csv.

Empty fields of bad lines should be completed by fields of the
previous good line
that have all fields completed.

foo0;bar0;foo1;bar1;foo2;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
;;foo1;bar1;foo2;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
foo0;bar0;;;;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
fooA;barA;fooB;barB;fooC;barC;fooD;barD;fooE;barE;fooF;barF;
foo0;bar0;;;;bar2;foo3;bar3;foo4;bar4;foo5;bar5;

should be

foo0;bar0;foo1;bar1;foo2;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
foo0;bar0;foo1;bar1;foo2;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
foo0;bar0;foo1;bar1;foo2;bar2;foo3;bar3;foo4;bar4;foo5;bar5;
fooA;barA;fooB;barB;fooC;barC;fooD;barD;fooE;barE;fooF;barF;
fooA;barA;fooB;barB;fooC;barC;fooD;barD;fooE;barE;fooF;barF;


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: