Teja
Teja

Reputation: 13534

How to delete multiple lines of special characters in vi editor

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

Answers (1)

Jacob Krall
Jacob Krall

Reputation: 28835

In vim (and possibly vi),

:g/foo/d

will remove all lines matching the pattern foo.

Upvotes: 3

Related Questions