title: Get just the certificate portion from an openssl pem file
body: <p>I have a PEM format certificate which contains all the headers in ASCII/UTF-8 text. I would like to output just the certificate itself. In other words the portion between and inclusive of:</p>
  
  <pre><code>-----BEGIN CERTIFICATE-----
  </code></pre>
  
  <p>and </p>
  
  <pre><code>-----END CERTIFICATE-----
  </code></pre>
  
  <p>I can do this by simply cutting and pasting from the source pem file. However, I would like to do this using OpenSSL.  I have looked at the various <code>-text -certopt X</code> but none that I have tried give just the certificate portion.</p>
  
  <p>Is there any way of outputting just the encoded certificate using OpenSSL?  How is it done?</p>