Sunday's bankruptcy filing by grocery store chain Great Atlantic & Pacific Tea Company (NYSE: GAP), better known as A&P, would have been unimaginable years ago. Today, it's just a sign of the times.

The nearly 400-store retailer opened its first store more than 140 years ago, and was incorporated as a grocery chain in 1900. The company became the largest chain of grocery stores in the United States in the 1930s, and was able to endure the depths of the Great Depression.

Ben Graham even discussed the company in his legendary value investing book The Intelligent Investor. However, even four decades ago, he saw the company's earnings in steady decline. While A&P has had some peaks and troughs since that particular edition of Graham's book came out, his point of emphasis should not be lost on investors.

Bad industry, worse company
Today, the economic issues facing the U.S. economy are only one of the headwinds facing the traditional grocery industry. The sector has not been kind to investors, even as the economy has picked up over the last year. In court filing documents, the company's chief restructuring officer, Frederic Brace, blamed the company's troubles on many of the issues facing the entire industry.

Discount retailers and wholesale clubs such as Wal-Mart (NYSE: WMT), Costco (Nasdaq: COST), Target (NYSE: TGT), and BJ's (NYSE: BJ) have continued to expand into the grocery space, and have pricing-power advantages that smaller grocers can't compete with. While these retailers are stealing value-oriented customers, many of the big-ticket spenders are frequenting higher-end retailers like Whole Foods (NYSE: WFMI) and Trader Joe's. In addition, A&P and competitor Safeway (NYSE: SWY) attempted to maintain their prices, while the majority of grocery chains attempted to promote value and lowered prices significantly, only adding to the sales squeeze.

The company also has other issues, including large pension funding requirements, an unfavorable supplier agreement, and leases on property where it has closed down stores and no longer operates. A&P had become an extremely overleveraged company in a razor-thin margin industry, which left it almost no room for error.

Lessons from Graham
In most cases, I wouldn't pay much attention to one of the worst operators in a sector that doesn't offer anything in the way of investing value. However, A&P's bankruptcy made me reach for my copy of Ben Graham's The Intelligent Investor, where Graham focuses on A&P in two important investing lessons.

The first lesson is that the stock market often creates great investing opportunities for advantageous and astute investors who see and understand mispricing in stocks.  Graham pointed to examples in which shares in A&P were extremely undervalued near the end of the great depression in 1938, and soon after tripled. He also explained that in 1961, investors had placed a premium on the stock   because of past performance; by the next year, the price was cut in half.

The market creates great potential rewards for opportunistic investors. But however compelling a stock may look, it's important to understand the fundamentals that drive a particular company and its industry.

In his second point, which is most relevant to the A&P story today, Graham says, "We see in this history how wide can be the vicissitudes of a major American enterprise in a little more than a single generation, and also with what miscalculations and excesses of optimism and pessimism the public has valued its shares." He reminds investors, "[M]ost businesses change in character and quality over the years, sometimes for better, perhaps more often for the worse."

Know when to let go
Keep in mind that Graham first published this book in 1949, and the revised version I've referred to is nearly 40 years old. But his point still rings true. Many investors have gotten burned, especially over the last few years, as once-great companies lose significant value or go away completely.

While one can interpret Graham's point a number of ways, A&P's recent struggles illustrate that even once-mighty companies can fail. As an investor, it's important not to fall in love with companies or brands that don't love you back. Look for companies that you believe are great operators with strong growth potential, or companies that investors are undervaluing. If something about the business or valuation changes your thesis, though, don't hesitate to hit the sell button.

It seems simple, but for most investors, letting go of stocks is very difficult. It could be because of a passion for the company, a possible tax hit, or maybe they've just held the stock for a long time. However, I'm sure many A&P shareholders and legacy investors would have gladly taken the loss a while ago if they'd known they'd take a complete loss now. Investors would be wise to keep Graham and A&P in mind whenever evaluating their portfolio.