FamilyMart Co. has agreed to buy Uny Group Holdings Co., the operator of the Circle K and Sunkus chains, creating the nation's second-largest convenience store operator.