> I have some tab delimited data of the following form:
> <tab>0001.50<tab>000000100<tab>0007
> <tab>0035.25<tab>000025444<tab>0010
> ...etc...
>
> I would like to replace any consecutive series of "0"s imediately
> following a tab with spaces.
>
> Now I know I could do something like ":s/\t0*/\t /g" but that would
> just replace any series of "0"s with just one " ". I want each "0"
> following a tab to be replaced by a " ".
>
> I can use the data the way it is (it's an input to a Fortran routine),
> but readability would be helped by making this edit.
>
> Is there a quick way to do this?
You could try
:%s/\t\zs0\+/\=repeat(' ', strlen(submatch(0)))/g
This assumes Vim7 or later as repeat() was added in v7. If you
want to keep at least one digit (e.g. "000000000"), you could use
:%s/\t\zs0\+\ze\d/\=repeat(' ', strlen(submatch(0)))/g
-tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---