:%g/error/d
If you want to, say, delete all lines beginning with a pound sign (#) -- that is, remove all the comments -- you need to escape the caret (^) which denotes the beginning of the line, as well as the pound sign itself, like so:
:%g/\^\#/d
While this would seem to be a common activity in vi, it was incredibly hard to find
documentation about it, despite Google and all the books I have that cover vi. IBM to the
rescue: I found this concise page that told me exactly what I wanted:
http://users.ca.astound.net/baspence/AIXtip/vi_del_lines.htm>/a>
06/24/2008