The announcement marks the end of a more than four-month effort by the Irving, Texas-based Nexstar, led by Chief Executive Perry Sook, to reach an agreement to buy Richmond, Virginia-based Media General, which had previously rebuffed its offers. Before Media General can be bought by Nexstar, it needs to get out of its merger agreement to buy New York-based Meredith Corp for $2.34 billion.