If I want to use "grep -f PATTERNS" to load patterns from a file, how do I tell it to ignore comments (lines that start with #) and blank lines from the PATTERNS file?
$ grep -f PATTERNS /etc/passwd
While the 2 comments are technically not ignored, they do not match anything because the pattern "#hplip" and "#The following is a blank line" do not appear in /etc/passwd, making it not as big a problem (though explicitly ignoring commented out lines would be better).
#The following is a blank line
The blank line on the other hand matches everything. Without the blank line in the PATTERNS file, only 5 lines from /etc/passwd are returned. With the blank line, all the lines of /etc/passwd are returned! Is there any way to tell grep to ignore the blank lines in the PATTERNS file?