I agree with what's been suggested long-term, but I am concerned over the immediate issue. You mention the shark being nasty (to put it mildly) towards the barbs. This is only going to get worse, and probably much worse, fast. This species (the red tail shark) is naturally hostile to substrate fish and frequently upper fish it takes a dislike to, often due to stripes I'm told. Whatever the reason, if the individual shark is now beginning to flex its muscles, it is not going to change, ever. And what this means is terror for the fish targeted, which causes stress and poor health, and quite likely early death. This sort of situation should never be allowed to continue.
As giving the fish away to anyone seems impossible, I would put the shark in the 40g on its own. My only reservatio here is that the barbs in the tank with the cichlids may well be targeted by them, so perhaps the barbs should be moved into the 40g.
Next issue to surface will be the behaviour of the green terrors and Jack Dempsey. Both fish have common names suggestive of their temperaments. This will soon become a problem too.
Of course one option which unfortunately is sometimes necessary, is to destroy the problem fish. You could try to find nearby aquarists who might want some of these, but if that is unsuccessful you need to do something or the fish will kill themselves anyway.