I would like to find a way to get the unique keys that are used inside
.yml files. These keys are used inside the hash
ENV. So, there are files that contain things like:
in multiple lines and at various positions within their lines. Also, those might appear multiple times within those lines.
So, If I have the file:
blah blah blah ENV['key1'] blah blah blah ENV['key2'] blah blah blah ENV['key2'] blah blah ENV['key3'] blah blah ENV['key2']
then I would like to get the list:
key1 key2 key3
I have managed to do this:
find . -iname "*.rb" -o -iname "*.yml" | xargs egrep 'ENV\[.(.*).\]'
but I do not know how to actually get the keys.
Any help would be much appreciated.