Created
April 18, 2023 20:03
-
-
Save Oats87/c2de1416f1da101c70a4156cf5e48726 to your computer and use it in GitHub Desktop.
This requires `yq`, `diff`, and `bash`
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 | |
FILE=${1:-0} | |
if [ "${FILE}" = "0" ]; then | |
echo "need to specify a file" | |
exit 1 | |
fi | |
fileNo=$(ls $FILE-split | wc -l | awk '{print $1}') | |
fileNo=$((fileNo-1)) | |
last=0 | |
for i in $(seq 0 $fileNo); do | |
echo Diff of $FILE-split/$last.yaml and $FILE-split/$i.yaml: | |
diff -C 5 $FILE-split/$last.yaml $FILE-split/$i.yaml | |
last=$i | |
done |
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 | |
set -e | |
FILE=${1:-0} | |
if [ "${FILE}" = "0" ]; then | |
echo "need to specify a yaml file" | |
exit 1 | |
fi | |
mkdir -p $FILE-split | |
IFS='' | |
fileIndex=0 | |
while read -r i; do | |
if [ "${i}" = "---" ]; then | |
fileIndex=$((fileIndex+1)) | |
fi | |
echo "${i}" >> $FILE-split/$fileIndex.yaml | |
done <$FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment