Charter Communications said on Friday it would buy privately held rival Cox Communications for $21.9 billion, uniting two of the largest U.S. cable and broadband operators.