Split .ovpn file to ca, cert and key with awk

With the following awk commands one can simply extract ca, cert and key files:

awk '/<ca>/{flag=1;next}/<\/ca>/{flag=0}flag' client.ovpn > server-ca.pem
awk '/<cert>/{flag=1;next}/<\/cert>/{flag=0}flag' client.ovpn > server.crt
awk '/<key>/{flag=1;next}/<\/key>/{flag=0}flag' client.ovpn > server.key
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *