Delete specific contents of file in blob container

Amey Pimpley 1 Reputation point
2020-10-23T19:00:04.617+00:00

I have log files in container, I want to search a list of strings in the log file and delete the specific record of the file matching with the string and save the file in same container with same name.
Say the log file is
abc.txt
10/20/2020 12:00:00 this line contains log
10/21/2020 12:00:00 this line contains numbers
10/21/2020 12:00:00 this line contains string

so I want to search for strings (numbers, string) and eliminate those records and save abc.txt in same container so that it will look like
abc.txt
10/20/2020 12:00:00 this line contains log

I am trying with stremreader and streawriter, but it is not working

                using (StreamReader reader = new StreamReader(longestFile.Open()))
                {
                    using (StreamWriter writer = new StreamWriter(text.Open()))
                    {
                        while((line = reader.ReadLine()) != null)
                        {
                            bool res = true;
                                // Look for text to remove
                            foreach(string s in linesToRemove)
                            {
                                if(line.Contains(s))
                                {
                                    res = false;
                                }
                            }
                            if(res)
                            {
                                // Keep lines that does not match
                                writer.WriteLine(line);
                            }
                        }
                    }
                }
Azure Storage Explorer
Azure Storage Explorer
An Azure tool that is used to manage cloud storage resources on Windows, macOS, and Linux.
240 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,575 questions
Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
342 questions
{count} votes