Ever wonderered how to uninstall same family of gems without uninstalling everything from your rubygems folder?
I have mistakenly installed
aws-sdk gem when I all I needed was just
aws-sdk-s3 gem but left the command to complete and after sometime to my horror there were 264 gems installed which correspond to every available AWS services!
So, I wanted to remove all aws-sdk gems and startover again but at the same time didn't want to break my other gems. So I did write up small shellscript like the following:
$ for x in `gem list aws-sdk- --no-versions`; do gem uninstall $x -a -x -I; done
Voila! All my 264 gems are uninstalled, not touching any other gem which is out of scope(Thanks to AWS folks with their naming convention as their every gem starts with aws-sdk- prefix.).