Say I'm editing a 1000 line file.
I want to keep lines 1-500 untouched.
But I want to delete all lines after line 500 that match "ABC"
How can i do this?
I can do all lines line this
:g/ABC/d
And i can delete all lines in range
:501,$d
But how to delete only lines that match a pattern?
(Been using vi since 1989. Just can't think how to do this! Sorry if it's obvious)
:global
takes a range, too. Thus you want:
501,$g/ABC/d
:-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With