To provide a little more explanation for the above command, the caret '^' represents the start of a line, so you're testing only for # symbols that appear at the beginning of each line. And the '-v' option in grep inverts the selection, so only lines that don't
match get displayed.
I suggest working your way through a simple Regular Expression (regex) tutorial (such as this one
) if you really want to know how to harness the power of text matching. It's really worth the effort.
Edit: You can pipe the output through grep again to remove the blank lines. There may be more 'proper' ways to do it, but quick and dirty:
grep -v '^#' filename | grep -v '^$'
The '$' sign matches the end of a line.