Skip to content

Instantly share code, notes, and snippets.

@tfentonz
Last active September 14, 2017 03:10
Show Gist options
  • Save tfentonz/99e03802fe112008e803d84527041baa to your computer and use it in GitHub Desktop.
Save tfentonz/99e03802fe112008e803d84527041baa to your computer and use it in GitHub Desktop.
Fix Private Key
#!/bin/bash
#
# Replace spaces with @'s
# Replace @'s in BEGIN with spaces
# Replace @'s in END with spaces
# Replace @'s with newlines
sed -i '' -e 's/ /@/g
s/-----BEGIN@RSA@PRIVATE@KEY-----/-----BEGIN RSA PRIVATE KEY-----/
s/-----END@RSA@PRIVATE@KEY-----/-----END RSA PRIVATE KEY-----/
s/@/\'$'\n/g' $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment