Dozens were injured in two attacks hours apart near Johannesburg and Cape Town, as police search for the perpetrators.