VIm Question ...

C M Reinehr cmr at amsent.com
Wed Oct 17 07:52:15 PDT 2007


Ben,

On Wednesday 17 October 2007 09:57, 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.
>
> Anyway, Thanks.

:v/works_4/d

if you want to delete lines with works_4 appears anywhere in the line, or

:v/^works_4/d

If you want to delete lines only when works_4 only appears at the beginning of 
the line.

cmr
-- 
Debian 'Etch' - Registered Linux User #241964
--------
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC



More information about the Linux-users mailing list