Reputation: 13534
I would like to delete multiple lines from a text file using vi editor. I can actually grep on such special patterns and list out them but how can I delete them from a file on the fly. Please share your thoughts if there is any command for that.
Upvotes: 1
Views: 1604
Reputation: 28835
In vim
(and possibly vi
),
:g/foo/d
will remove all lines matching the pattern foo
.
Upvotes: 3