c#

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace TextCopy
{
class Program
{
public Program()
{
}
static void Main(string[] args)

{
StreamReader sr = new StreamReader("d:\\work\\MBSA.tsv", Encoding.GetEncoding("Shift_JIS"));
StreamWriter sw = new StreamWriter("d:\\work\\dest2.txt", false, Encoding.GetEncoding("Shift_JIS"));

string line = "";
int fg = 0;
while *1 != null)
{
//セキュリティ更新プログラム が出てきたら書き込みを開始
if (Regex.IsMatch(line, @"^\t\t[セキュリティ更新プログラム]"))
{
fg = 1; //1開始
}
//更新プログラム が出てきたら書き込みを中止
if (Regex.IsMatch(line, @"^\t\t+[更新プログラム]"))
{
fg = 2; // 2終了
}

if (fg == 1)
{
while (line.Length > 0)
{
int post = line.IndexOf("|");
if (post == -1)
{
Console.Out.WriteLine(line);
break;
}
string ss = line.Substring(0, post);
Console.Out.WriteLine(ss);
sw.WriteLine(ss);
line = line.Substring(post + 1);
}
//sw.WriteLine(line);



}
if (fg == 2)
{
break;
}
}
sr.Close();
sw.Close();
}
}
}

*1:line = sr.ReadLine(