vim Tip: Delete all lines which….

I had a copy of /etc/hosts.deny that I wanted to format up to extract the hostnames from… Every other line started with a comment, though, and I wanted to strip those…

:g/#/d

Will match all lines (:g) which contain (not necessarily “start with”) # and delete (d) them.

Leave a Reply

Your email address will not be published. Required fields are marked *