Created
October 23, 2013 11:36
-
-
Save trajakovic/7116987 to your computer and use it in GitHub Desktop.
Split SSL PEM multiple certificates into files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O - http://curl.haxx.se/ca/cacert.pem | awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".pem"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for providing this sample, the modification below makes sure that all files have numbers starting with 0, and if there are no certificates in the file no output is created.