Delete the desired lines in text file

Hi. I’m having problems with text files
Specifically I want to get the rows starting from the 9th column in files
The remaining lines, if not starting from the 9th column, will delete the entire row
I have tried with generate datatable then filter data table but it doesn’t work for me.
So I would really appreciate it if someone could show me how to do it
doc.txt (130 Bytes)
Input
image
Output
image

Hello @Akaza

How you are getting this files? Is this format the same for the input file or will it get change?

1 Like

arrLinesFiltered =  File.ReadAllLines(YourFilePath).Where(Function (x) x.TakeWhile(Function (s) s.equals(" "c)).count > 6).ToArray
strText = String.Join(Environment.NewLine, arrLinesFiltered)
arrLinesFiltered  | DataType: String() - String Array
strText | DataType: String
YourFilePath - Your FullFilePath to the text file
1 Like

it is an output of a macro. After changing, the format will not change

thanks i will try and reply you later