Hi, How about: :%s/\n\(YYY\)\@!/ \1/g
Explanation: \n - new line \(YYY\)\@! - not followed by YYY / \1/ - replace with a space plus the line On Fri, 21 May 2021 at 12:46, Igor <[email protected]> wrote: > > I have the following data: > > YYY AAA > YYY BBB > CCCCC > YYY CCC > DDDD > EEEE > (and few hundreds rows) > > Rules: > 1. First line always starts with YYY. > 2. Line should start with YYY. > 3. All lines that do not start with YYY must be joined into previous lines. > > Above sample data should become: > > YYY AAA > YYY BBB CCCCC > YYY CCC DDDD EEEE > > How to accomplish transformation? > Regards > > -- > -- > 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/8152ff6a-9bb8-4c0b-91a5-9df523d70562n%40googlegroups.com > <https://groups.google.com/d/msgid/vim_use/8152ff6a-9bb8-4c0b-91a5-9df523d70562n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- 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/CALe4Hp%3Dxk0EKekeD6iCEi6YBVwRzWu4eVPGB7DU53XyuNMU8AA%40mail.gmail.com.
