you could try something like

:%s/^\s*\(\w\+\)\s*-\s*\(\w\+\)/\=submatch(1).strpart('               ',
strlen(submatch(1))).' - '.submatch(2)/

(all in one line)

:help sub-replace-special

On 5/15/06, Popovic Dan <[EMAIL PROTECTED]> wrote:
Hello dear list-members,

I have a question on replacing text. I have a simple text-file with a table of 
results like this:

------------------------------------------------------
Mosbach -   KSF 2                   2 : 6

Zimmer        -   Pfrommer 0
Mueller       -   Kargoll 1
Schwab        -   Fecht 0
Mattern       -   Arlt 0
Huth -   Mueller 0
Alm -   Kiefhaber,H.  0.5
Rastert       -   Vinke 0
Schnirch -   Kiefhaber,V.  0.5

I would like to have the file formatted, e.g. first to have all the "-" in one 
column (for example at position 15), like this:

------------------------------------------------------
Mosbach      -   KSF 2              2 : 6

Zimmer        -   Pfrommer       0
Mueller        -   Kargoll           1
Schwab        -   Fecht              0
Mattern       -   Arlt                 0
Huth            -   Mueller           0
Alm              -   Kiefhaber,H.   0.5
Rastert         -   Vinke              0
Schnirch      -   Kiefhaber,V.    0.5

I played with some search & replace commands, for example:

:%s/^\([A-Z][a-z]* \)/\1    /

But I do not know how to tell VIM that it should fill the room with whitespaces 
till position 15 (like above).
I'm convinced this is possible but I do not know how, since I just began to 
learn the powerful regex-functionality....

Thank you for any help!

Best regards,

Dan





--
Dan Popovic
Klausenpfad 22; 69121 Heidelberg
[EMAIL PROTECTED]; Tel. 06221/7282102 oder 01743036428
http://www.rzuser.uni-heidelberg.de/~dpopovi2/index.html
_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


Reply via email to