R.H. Donnelley ( RHD) agreed to buy Dex Media ( DEX) in a deal valued at $4.2 billion, creating one of the nation's biggest publishers of directories.

Each Dex share will be exchanged for $12.30 in cash and 0.24154 Donnelley shares. Donnelley will also assume Dex's debt, which will probably be around $5.3 billion at the end of the year.

Dex shares ended Friday at $27.79, and Donnelley last closed at $63.26. Based on Donnelley's most recent closing price, the pact values Dex at around $27.58 a share.

The combined company will be the third-largest print and Internet directory publisher in the U.S. with revenue that would amount to around $2.7 billion a year on a pro forma basis. The company will have more than 600 directories with a total circulation of 73 million.

After the merger closes, Dex shareholders will own about 53% of the combined company. The new firm will use the R.H. Donnelley name and be based in Cary, N.C.

More from Stocks

Neel Kashkari: The Heart of Our Financial System Is More Radioactive Than Ever

Neel Kashkari: The Heart of Our Financial System Is More Radioactive Than Ever

Finding Stocks Right for You: Cramer's 'Mad Money' Recap (Friday 8/25/18)

Finding Stocks Right for You: Cramer's 'Mad Money' Recap (Friday 8/25/18)

Flashback Friday: Amazon, Chip Stocks, Memorial Day

Flashback Friday: Amazon, Chip Stocks, Memorial Day

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%