grep.cpp condensed