Skip to content

Instantly share code, notes, and snippets.

@dzabel
Last active March 12, 2019 12:15
Show Gist options
  • Save dzabel/1be797ab58dfd43a69f1752d0ff9e4c9 to your computer and use it in GitHub Desktop.
Save dzabel/1be797ab58dfd43a69f1752d0ff9e4c9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
LC_CTYPE=C
LANG=C
FILE=$1
for props in $(cat $FILE | cut -d= -f 1 | grep -v ^$ | grep -v \# | grep -v "^\ "); do
LINE=$(grep "^$props" $FILE | awk -F= '{print $2}')
if [[ $LINE == *'${'* ]]; then
IFS=',' read -r -a array <<< "$LINE"
for element in "${array[@]}"
do
echo -n "$props "
echo -n "$element" | awk -F\} '{printf "%s",$1}' | awk -F\$ '{printf "%s",$2}' | sed 's/{//' | sed 's/}//'
echo " # $FILE"
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment