I am using this code to read a logfile and strip out the data I dont
want and write that data to a new log file. When I run the code below
it works fine removing any line that contains "35=0". once I uncomment
the the rest and try to catch "35=1" "35=2" etc... it runs thought and
makes an exact copy of the original file, not removing any of the
lines. New to C# and not sure why this is happening. Also tried
turning below into a switch statement but that didnt even compile.
Thanx in advance for any help.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StripFixLog
{
    class Program
    {
        static void Main()
        {
            string lines;

            // Read the file and display it line by line.
            System.IO.StreamReader rfile =
              new System.IO.StreamReader("C:\\Users\\mweppler\
\TestFolder\\testlog.log");
            using (System.IO.StreamWriter wfile =
              new System.IO.StreamWriter(@"C:\Users\mweppler\TestFolder
\criticalData.log"))
            {
                while ((lines = rfile.ReadLine()) != null)
                {

                    if (lines.Contains("35=0") == false) // ||
lines.Contains("35=1") == false || lines.Contains("35=2") == false ||
lines.Contains("35=4") == false || lines.Contains("35=5") == false ||
lines.Contains("35=A") == false)
                    {
                        //Console.WriteLine(lines);
                        wfile.WriteLine(lines);
                    }
                }
            }

            rfile.Close();

            // Suspend the screen.
            //Console.ReadLine();
        }
    }
}

Reply via email to