I'm looking for a tool that can give how many methyl groups, hydroxyl groups etc are in a compound's structure presented as SMILES, SDF or MOL2 format.
There are numerous programs, but it's pretty easy to use the obgrep tool in Open Babel to do this using SMARTS for the various functional groups:
obgrep -c '[CX3]' file.sdf # count the number of methyl groups
obgrep -c '[#6][OX2H]' file.sdf # count the number of hydroxyl groups
etc. Examples of functional groups using SMARTS can be found on the Daylight SMARTS examples page.
I've also written scripts in Python for these purposes - depends on how you want to run the SMARTS searches.