Discovery Communications has agreed to acquire Scripps Networks in a deal valued at about $11.9 billion, combining two powerhouses of nonfiction television programming at a time of major upheaval in the cable-TV business.