Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# how to search textfile and append

using System.IO;
using System.Linq;

static void Main(string[] args)
{
     var reader = new StreamReader(File.OpenRead(@"C:	est.ini"));

        List<string> data = new List<string>();
        while (!reader.EndOfStream)
        {
            var line = reader.ReadLine();
            var values = line.Split('	');

            if (values.Contains("REMOVE"))
                continue;

            //
            data.Add(string.Join("	",values));

        }

        //Inside data you have all the lines without the removed. You can rewrite
        //to other file 


}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #search #textfile #append
ADD COMMENT
Topic
Name
8+2 =