using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace MyGrep
{
class Program
{
static void Main(string[] args)
{
string str = @"^i";
string path = @"F:/1.txt";
grep(str, path);
}
static void grep(string str, string path)
{
Regex rx = new Regex(str);
using (StreamReader sr = File.OpenText(path))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
if (rx.IsMatch(s))
Console.WriteLine(s);
}
}
}
}
}
MyGrep
最新推荐文章于 2015-12-11 11:09:13 发布