Friday, May 21, 2021

How to perform join of lines on many rows following simple rules?


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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8152ff6a-9bb8-4c0b-91a5-9df523d70562n%40googlegroups.com.

No comments: