Reputation: 27594
text file:
a
b
c
d
e
f
Now I want to search for the content c
and delete the matched line and the another line immediately before it, that is, I want to delete the line b
and c
, I've tried :g/c/ .,-1 d
, but it didn't work. How to make it?
Upvotes: 2
Views: 75
Reputation: 1547
You can use replace:
:%s/.*\nc\n//gc
If there is some text after c, you can use:
:%s/.*\nc.*\n//gc
Upvotes: 1