C# txt文档内容的事情

Regex rgx = new Regex(@"http://www.XXXX.com/file/d{10}/");
 
string path = @"H:", newTxt = @"H: ewTxt.txt";
 
            var query1 = from f in Directory.GetFiles(path)
                         let arr = File.ReadAllLines(f)
                         where f.EndsWith(".txt")
                         select new
                         {
                             content = (from c in arr                                        
                                        where rgx.IsMatch(c)
                                        select c)
                         };
 
 
            query1.ToList().ForEach(item => File.AppendAllLines(newTxt, item.content));
 
            foreach (var str in File.ReadAllLines(newTxt))
            {
                Console.WriteLine(str);
            }
原文地址:https://www.cnblogs.com/tested/p/3359128.html