I've seen multiple answers to delete a single line with
grep, but I'm in need to search for a line, delete that one, and the 2 proceeding lines. For example, in the file
~/.profile I have lines like:
#Set environment variable export NAME=value # (blank line here)
So I'd like to search for
#Set environment variable, and delete it, then delete the next line
export NAME=variable (content shouldn't matter), and the following blank line. The
export variable names are dynamic, but the comment will always be the same. There could be other
export variables without the above comment which I do not want to delete.
How can I accomplish this?