ファイルをいくつか処理する必要があり(主にログファイル)、各行にregexを使用する必要があります。私はC#特定の行のファイルの読み込みを開始する
using (FileStream fs = File.Open("logs.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (BufferedStream bs = new BufferedStream(fs))
using (StreamReader sr = new StreamReader(bs))
{
string line;
while ((line = sr.ReadLine()) != null)
{
// use regex and add create new file..
}
}
しかし、私は同様に「名前の変更」を持っているので、誰かが自分の名前を変更した場合、私は他の名前この時点で、再びログを処理する必要がログにしてください。それは私がこれをする時間を節約することができるように、それは特定の行から読み始めてもいいですか?
string line - >代わりにstringbuilderを使用します。文字列行= File.ReadLines(FileName).Skip(14).Take(1).First(); – cutzero
@cutzeroありがとう私はそれを試します – user1546616
あなたは次のパスでピックアップする場所を覚えて、[シーク関数](https://stackoverflow.com/a/5404324/1132334)を使用して – dlatikay