I have a file and I want to do the following.
- copy every n lines starting from m (m,m+n,m+2n, ...)
- copy line number 2, 5, 27, ... by specifying line numbers.
THanks
To copy every N lines, you can use :global
with an expression that selects the lines:
:let @a = ''
:g/^/if line('.') % 3 == 0 | yank A | endif
For explicit lines, I would sequentially call the :yank
command:
2yank a | 5yank A | 27yank A
This uses yanking into the uppercase register to append to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With