I'm trying to filter a part of a file that holds 2 digital certificates. Basically, I want the first part (let's say Cert1) and not the second part (Cert2).
Content of the file is:
-----BEGIN CERTIFICATE----- AAAA AAAA ETC -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- AAAA AAAA ETC -----END CERTIFICATE-----
I was under the impression that this would give me the content of Cert1 (the first part between the first BEGIN and the first END):
cat /etc/nginx/cert.pem | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
For some reason, though, it still presents me all the content between the second BEGIN and the second END (basically, nothing changes; all content is the same).