NEW YORK - Stocks ended Thursday mostly flat, recovering from broad losses earlier in the session. Investors continued to focus on corporate earnings, and Thursday's batch brought mostly disappointing results.

The Dow Jones industrial average lost 5.41 points, less than 0.1 percent, to close at 17,745.98, rallying from 110 points down at the beginning of the day. The Nasdaq composite rose 17.05 points, or 0.3 percent, to 5,128.78. The Standard & Poor's 500 index closed effectively unchanged, up 0.06 of a point at 2,108.63.

Several companies made big moves after reporting their quarterly results.

Consumer-products giant Procter & Gamble fell $3.23, or 4 percent, to $77.39. The maker of Tide detergent and Gillette razors reported softer sales than analysts had expected. The company, like many others, has been negatively affected by the strong dollar, which makes U.S. products more expensive abroad.

Whole Foods plunged $4.74, or 12 percent, to $36.08. The company reported a sharp slowdown in sales growth last quarter, partially hurt by recent news that some of its New York City locations were overcharging customers.

Facebook fell $1.78, or 1.8 percent, to $95.21 after the company's results, while positive overall, included an 82 percent jump in expenses as the company invested in growth. Facebook's stock hit an all-time high on July 21.

Many U.S. companies reporting second-quarter earnings have struggled to increase sales despite modest growth in this country and elsewhere. FactSet estimates that revenue at companies in the S&P 500 has decreased 4 percent from a year ago, largely due to weakness in the energy sector. Even when energy is excluded, revenue is still up only 1.8 percent.

"It's really a reflection of how lackluster this economic growth has been," said Jack Ablin, chief investment officer at BMO Private Bank in Chicago. "Profits can be manipulated by cutting costs [and] buying back shares, but your top line is your top line and if you aren't growing sales, it's very hard to mask that."

In fuels trading, the price of oil resumed its slide after two days of gains. Benchmark U.S. crude fell 27 cents to close at $48.52 a barrel in New York. Brent crude, a benchmark for international oils used by many U.S. refineries, fell 7 cents to close at $53.31 a barrel in London.

Wholesale gasoline rose 0.6 cents to close at $1.828 a gallon. Heating oil closed unchanged at $1.598 a gallon. Natural gas fell 11.8 cents to close at $2.768 per 1,000 cubic feet.

In metals trading, gold lost $4.60 to close at $1,088.70 an ounce, silver gave up 5 cents to $14.70 an ounce, and copper fell 3 cents to $2.38 a pound.