On 10/03/11 14:07, superfish wrote:
Facing with a data file which contains more than 7 million lines, I need to
delete all lines containing<patternA>  but not containing<patternB>.
So far the only way I can think of is kind messy, something like this:

:g/<patternB>/s/<patternA>/<patternC>/
:g/<patternA>/d
:%s/<patternC>/<patternA>/

But I really like to know how this can be done in a better way, like a
single global replacement command or something.

Dr. Chip's LogiPat.vim makes this less painful. A quick test suggests that you're looking for something like

 :g/\%(.*patternA.*\&^\%(\%(patternB\)\@!.\)*$\)/d

-tim





--
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

Reply via email to