I have a file that contains a bunch of certificates:
-----BEGIN CERTIFICATE-----
AAAAAAA
AAAAAAA
AAAAAAA
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
BBBBBBB
BBBBBBB
BBBBBBB
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
CCCCCCC
CCCCCCC
CCCCCCC
-----END CERTIFICATE-----
I want to chop the one that said A
in it and just have the B
C
... n
certificates.
It's very similar to this question and I was hoping for a portable way to do this. Preferbly with sed
if possible but awk
works too if it's not possible to do with sed
.
Is there a way to make sed print until a particular value EXCEPT for the first occurrence?
BEGIN CERTIFICATE
) occur without a corresponding closing "end pattern" (END CERTIFICATE
)? If so, what would you want the solution to do? – AdminBee Mar 28 '22 at 15:26sed '1,/END CERT/d'
? – Stéphane Chazelas Mar 28 '22 at 16:00sed
novice)? ;) – AdminBee Mar 28 '22 at 16:13