using System;
using System.IO;
namespace Find_String_In_Text_File
{
class Program
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader("d:\\wwwroot\\ajax.js");
string s;
while ((s = sr.ReadLine()) != null)
{
if ((s.IndexOf("getElementById")) != -1)
{
Console.WriteLine("Found");
Console.WriteLine(s);
//break; // remove the comment to find only the first occurrence of string in a file
}
}
sr.Close();
}
}
}