Using any popular tool on a GNU/Linux system (python, sed, awk, *sh, ...), I would like to output a list of all the words which match a given regex. Unlike the examples I found, I do not want to retrieve the list of the words from a given text which match the regex. For example, if the regex is "[aA]foo", I would like to have a tool which outputs:
afoo
Afoo
If the regex matches an inifinite number of words (eg. "a*"), I do not expect it to be smart, it may crash or whatever.
I would like to have the output in a file with one word per line (or in any format I can redirect to a file). The expected ouput size is about 20K words.
Edit
Using the keyword "generate" from the duplicate proposition, I think this question is more a duplicate of this one: Using Regex to generate Strings rather than match them