Andre Tann said on Tue, 25 May 2021 23:00:25 +0200

>Hi all,
>
>I repeatedly have the following situation, and wonder how it can be 
>handled better than I do it now. These lines must be merged
>
>/path;text
>/path;text
>/path;text
>
>with these:
>
>/subdir
>/longsubdir
>/longlongsubdir
>
>Result:
>
>/path/subdir;text
>/path/longsubdir;text
>/path/longlongsubdir;text
>
>
>What I do now is to mark and yank the second block, go to the first 
>semicolon, and press P. Result is:
>
>/path/subdir        ;text
>/path/longsubdir    ;text
>/path/longlongsubdir;text
>
>But this is obviously not what I want. How can I avoid the extra
>blanks?

I'd write a Python program to do this. Here's pseudocode of the main
loop:

until eof filea
        read filea into stringa
        read fileb into stringb
        stringc = stringa + stringb
        write stringc to filec

You'd also need to open and close the files, and you'd need an error
condition for the situation where the two files have a different number
of lines. But a different number of lines would be a horror movie for
the Vim solution too.

SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20210528082423.449fd810%40mydesk.domain.cxm.

Reply via email to