Created
August 24, 2017 14:59
-
-
Save SiM07/57131ace83deaa4cd000629c74a479ea to your computer and use it in GitHub Desktop.
Global editor config
This file contains hidden or 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
#!/usr/bin/env bash | |
find ~/Code \ | |
-name *config*.yml \ | |
-ipath *.k8s* \ | |
-ipath */preprod/* \ | |
-type f \ | |
| while read file | |
do | |
exists=$(cat $file | grep $1 | wc -l) | |
if (( "$exists" <= "0" )); | |
then | |
continue | |
fi | |
echo $file | |
echo ----------------------------------------------- | |
value=$(cat $file | grep $1 | awk '{print $2}') | |
oldvalue=$(echo -n $2) | |
newvalue=$(echo -n $3) | |
echo "Current in file $value" | |
echo "Ask replace $2 by $3" | |
echo | |
sed -i -e "s|\"$oldvalue\"|\"$newvalue\"|g" $file | |
done |
This file contains hidden or 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
#!/usr/bin/env bash | |
find /Users/sim07/Code \ | |
-name *secret*.yml \ | |
-ipath *.k8s* \ | |
-ipath */preprod/* \ | |
-type f \ | |
| while read file | |
do | |
exists=$(cat $file | grep $1 | wc -l) | |
if (( "$exists" <= "0" )); | |
then | |
continue | |
fi | |
echo $file | |
echo --------------------- | |
value64=$(cat $file | grep $1 | awk '{print $2}') | |
value=$(echo $value64 | base64 --decode) | |
oldvalue64=$(echo -n $2 | base64) | |
newvalue64=$(echo -n $3 | base64) | |
echo "Current in file $value ($value64)" | |
echo "Ask replace $2 ($oldvalue64) by $3 ($newvalue64)" | |
echo | |
sed -i -e "s|$oldvalue64|$newvalue64|g" $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment