Associated British Foods has confirmed it will separate Primark from its food businesses through a demerger, ending months of speculation.