Created
February 12, 2019 22:50
-
-
Save cxhercules/964903ec0511a1552cc68f3df7ceb877 to your computer and use it in GitHub Desktop.
awk run system command against field
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 | |
cat secrets-alone.yml |awk -F: '{ printf "export %s=",$1; system ("echo "$2"|base64 -d "); system("echo")}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will work against input like following:
And actually this example above will work without the extra echo.
cat secrets.yml |awk -F: '{ printf "export %s=",$1; system ("echo "$2"|base64 -d ")}'
But when getting output from kubernetes secrets you will need that extra echo to give newline. At least that is one way to do it.