How to uninstall all but default gems?

The following one liner will remove all but the default gems.

gem list | awk '{print $1}' | grep -Ev 'bundle|test-unit|rdoc|psych|io-console|minitest|rake|bigdecimal|json' | xargs gem uninstall -Iax

The grep pattern is something that is more suited to my current project, but you get the idea. I will try to make a script soon, that will get all default gems and pass this to the grep block.