I am using grep to produce output that will be parsed by another program.
grep
However, that program expects output only to be numeric or zero-bytes.
No
You can pipe it through tr and translate the \n to a \0 character:
tr
\n
\0
tr '\n' '\0'