Say I'm in a double battle, and I have a Krokorok and an Excadrill. Krokorok uses Earthquake and while damaging the other pokemon, it knocks out Excadrill in the process. I know that knocking out other pokemon activates the abiity, but will Excadrill raise his attack? If you knock out multiple pokemon in one hit, will it raise his attack multiple stages at once too?
I actually have tested this in the past!
When a Pokémon with Moxie causes another Pokémon (including allies) to faint through direct damage, its Attack rises by one stage. Moxie will not be activated by indirect damage, such as through Sandstorm or an ability like Rough Skin. Moxie will not activate if an allied Pokémon defeats a foe in a double or triple battle. If a Pokémon with Moxie defeats a Pokémon with Mummy using a physical move, the Pokémon's ability will turn to Mummy before the attack boost is given. - Bulbapedia
So Yes, if he knocked out even an Ally, he would get his Attack boost, Neat isn't it?