using System;
using System.Text.RegularExpressions;
using System.IO;

class Grep
{
    static void Main(string[] args)
    {
        if(args.Length != 2) 
        {
            Console.WriteLine("Parameter: <Dateiname> <Suchausdruck>"); 
            return; 
        }

        try 
        {
            StreamReader sr = new StreamReader(args[0]);
            Regex re = new Regex(args[1]);
            int count = 0;
            String line;

            // Datei zeilenweise durchsuchen
            while((line = sr.ReadLine()) != null) 
            {
                Match m = re.Match(line);
                ++count;

                if(m.Success) 
                {
                    Console.WriteLine("Zeile {0,3}:  {1}", count, line);
                }
            }
        } 
        catch(Exception e) 
        {
            Console.WriteLine(e.Message); 
        }
    }
} 