so you need to find lines beginning with # and containing a specific word?
A single grep command can be do that, you just need to be familiar with it:
Code:
grep <pattern> filename
is the basic syntax you need to know. Filename is known, so only pattern should be constructed.
^ means the beginning of the line, so:
grep ^# filename will look for lines beginning with #.
grep word filename will look for lines containing word. You may need to combine this to get the required result and also may take into account if word contains special chars. See man grep about regular expressions understood...