I've read this question, but I want to know how can I delete the line when the pattern DOESN'T occur.
+12
A:
Deleting the rest of the line when a pattern does not occur is ... hard for me to understand.
Did you mean, delete the whole line if it doesn't have a pattern?
:v/pattern/d
If you meant, preserve the line but clobber the characters:
:v/pattern/s/.*//
DigitalRoss
2009-10-28 18:02:31
`:v/pattern/d` Just work fine. Thanks :)
unkiwii
2009-10-28 18:06:25
And yes, I mean delete the whole line
unkiwii
2009-10-28 18:06:57
+3
A:
Equivalently:
:g!/pattern/d
Easier to remember in my opinion, because!
is ingrained as "not" in my brain.
Brian Carper
2009-10-29 19:04:24