in reply to Grep lines from a text file, compare to an array using regex?
The very similar discussion in the recent node grep with looped tests may also be pertinent.