grep: optimize built-in grep by skipping lines that do not hit