grep is fine, it's just sed that is deficient