Handle grep returning non-zero exit code