The second major earnings disappointment in retail this week sent many investors running for the exits, but that's also created a few opportunities in the sector. On Wednesday morning, Target followed Walmart in delivering a big earnings miss for the first quarter, warning that rising costs were eating into profit margins. The report helped weigh on the retail sector as a whole, dragging down shares of discount stores, grocers and even nonfood retailers like Macy's . Walmart, fresh off an 11.4% decline on Tuesday , extended those losses on Wednesday. Oppenheimer analyst Rupesh Parikh said in a note to clients on Wednesday that inflation pressure is now spreading throughout the retail sector and doesn't appear to have been caused by management mistakes at a only a handful of companies. "The results clearly show cost pressures are now starting to weigh upon food retailer/discounter margins compared with uncharacteristically strong and stable margins for players from COST/WMT to conventional grocers (ACI and KR) the last several quarters," Parikh wrote in a note to clients. Oppenheimer maintained its top picks in the sector, including Costco and Dollar General , but Parikh said its analysts are reviewing their models ahead of those companies' earnings reports. One retailer that did report a solid quarter this week was Home Depot , but a potential slowdown in the housing market could make it tough for growth to continue even there. Mortgage applications for homebuyers just dropped 12% week over week . "You can't fight the Fed. It's really hard for the home centers to outperform in an environment of rising rates," analyst Michael Baker of D.A. Davidson said on "Squawk on the Street " Tuesday. Baker highlighted BJ's Wholesale and Grocery Outlet as two of his favorite stocks in the retail sector for the rest of the year. Outside of the retailers themselves, the inflation in the sector is affecting food producers, whose pricing models are intertwined with the store chains. "Packaged foods companies have generally celebrated how easy it has been to persuade grocer retailers to pass through pricing to offset inflationary costs for inputs and supply chain disruption," Credit Suisse analyst Robert Moskow wrote in a note to clients on Wednesday. "However, Walmart management now says that they are 'concerned' about the rate at which food prices have risen in the country and that their team will need to do more with their supply base to keep costs low. ... In our view, this sounds like management is drawing a 'line in the sand' on future pricing." Moskow said that private label companies such as TreeHouse Foods could see some lift from strong sales volumes from consumers trading down but still face cost pressures and a limited ability to raise prices. Bank of America analyst Bryan Spillane pointed to Kraft Heinz as a potential winner because it has already hiked prices, while stocks like Coca-Cola and Hershey could outperform due to their pricing power. However, Credit Suisse's Moskow warned that Kraft Heinz's processed meat business could weigh on its results. And what about Target and Walmart? Those companies may have had disappointing quarters, but the stocks are now trading well off recent highs. Walmart saw multiple price target reductions from analysts following its first-quarter report, but not full downgrades. Oppenheimer, for example, kept the stock on its top picks list. D.A. Davidson's Baker said he would consider using Walmart's pullback as a buying opportunity. The reaction from Wall Street analysts will not be clear for Target until later in the week. However, the stock did already receive a downgrade from Truist analyst Joshua Young, even as its shares dropped more than 20% early Wednesday. "While we still need to await more details and we HATE downgrading a stock after it is under significant pressure, we doubt this stock will get much support in the coming quarters after today's results and lowered 2022 outlook," Young wrote in a note to clients. — CNBC's Michael Bloom contributed to this report.