What word describes people who attack those doing the same thing as them?
Solution 1:
Yes, normally you would call such a person a hypocrite (exceptions include situations where actually the same standards should not apply for both persons).
However, hypocrite is a wider concept, that can be applied to anyone who is doing something different to what he is saying (in the domain of moral and ethics). So, to be a hypocrite I don't even need some specific person B, all I need to do is to claim that I have certain moral values but to disprove that through my actions.
It is completely appropriate to use it for essential moral values, but also for trivial things as well, for example if I point you to read the faq on this site, but have not done that myself, it would be justified to call me a hypocrite.
There are many other phrases: 'to have double standards', 'to be two-faced' or simply phoney; see other synonyms and near synonyms of hypocrite here.
Solution 2:
"The pot calling the kettle black" Also from the bible : Matthew 7:3 "And why behold you the mote that is in your brother's eye, but consider not the beam that is in your own eye?"