VIm Question ...
Jorge Almeida
jalmeida at math.ist.utl.pt
Wed Oct 17 07:55:28 PDT 2007
On Wed, 17 Oct 2007, Ben Duncan wrote:
> I need to know the command to delete lines that DO NOT contain a string.
>
> For example, I have lines that contain the strings in them "works_1",
> "works_2",
> "works_3" and so on.
>
> I want to hight light the rows and then delete the rows that DO NOT have
> the string "works_4" in them.
>
> The VIM manual states to use ":v/^dd/d" to do this, but it JUST does
> not work. Or maybe I am too old to understand what the ^$%#% it is saying.
>
I love vim and I hate the vim manual...
I would do
:!grep -v works_4
This does the job, unless you have some reason not to use the shell.
Jorge Almeida
More information about the Linux-users
mailing list