Skip to content

Instantly share code, notes, and snippets.

@e-minguez
Created June 8, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e-minguez/5ed00fd3c8c0fb7fc254 to your computer and use it in GitHub Desktop.
Save e-minguez/5ed00fd3c8c0fb7fc254 to your computer and use it in GitHub Desktop.
Get all constants in a bash script
cat ${FILE} | grep -o "\"*\$[{]*[[:upper:]]\{1,\}.*[}]*\"*" | sed -e 's|\(.*\):.*|\1|g' -e 's|[\"|{|\$]||g' -e 's|\(.*\)[[:blank:]].*|\1|g' -e 's|\(.*\)}.*|\1|g' -e 's|\(.*\)[[:blank:]]\].*|\1|g' | sort | uniq | grep -v [[:lower:]] | tr '\r\n' ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment