title: How to prevent grep from printing a trailing newline?
body: <p>I am using <code>grep</code> to produce output that will be parsed by another program. </p>
  
  <p>However, that program expects output only to be numeric or zero-bytes.</p>
  
  <p>Now <code>grep</code> outputs a newline character after its output.  I've checked the <code>-Z</code> option but it doesn't seem to work as I'm using grep for counting (<code>-c</code>).</p>
  
  <p>I am executing in <code>sh</code>, not <code>bash</code>. So nesting it into <code>echo -n "$(grep -c pattern)"</code> doesn't work either.</p>
  
  <p>How can I get rid off the trailing newline?</p>