Asis Hallab schrieb:
>
> I have a large file with structured text.
>
> I want to find blocks of text from a line matching my first regex up to a line matching my second regex.
> I'd like to be able to include or exclude the matching lines
> and I'd love to be able to execute a deletion or other command on such the found blocks.
>
> How do I accomplish this?
have a look at
:help cmdline-ranges
For example, to delete everything between two matches, excluding the
matching lines, execute
:/first regex/+1;/second regex/-1d
This will only the next block. If you want to delete all block, prefix
the command with "g":
:g/first regex/+1;/second regex/-1d
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--
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
No comments:
Post a Comment