Created
February 10, 2024 02:26
-
-
Save larsks/f26985c4773862508ab0ac6f6556a3b6 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Split a certificate bundle into individual certificates. | |
# | |
# This will produce files named `cert-000.crt`, `cert-001.crt`, .etc. | |
read -r count < <(csplit -z "$1" -f cert- -b '%03d.crt' '/^-----BEGIN CERTIFICATE-----/' '{*}' | wc -l) | |
echo "split $count certificates" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment