int counter = 0;
string line;
System.IO.StreamReader file = new System.IO.StreamReader(@"Test.html");
System.IO.File.WriteAllText("TestOut.txt", string.Empty);
while ((line = file.ReadLine()) != null)
{
if (line.Contains("<TITLE>") || line.Contains("<H1>"))
{
System.Console.WriteLine(line);
System.IO.File.AppendAllText("TestOut.txt", line + Environment.NewLine);
counter++;
}
}
file.Close();
System.Console.WriteLine("{0} lines found.", counter);