Do the filtering in Ruby rather than using fgrep.