Jo

Jo

  • NA
  • 3
  • 0

How to read a txt file into a two-dimensional array

Nov 16 2010 9:14 AM

Hello everyone,
I have a txt file with the following data:
 

line1
line2
line3
 
col1 col2 col3 col4
1 3 12 63
83 10 19 14
21 34 87 54 

I'd like to read that file, remove the header, remove col1 ......col4.
So, at the end I'd like to have the following data in a two-dimensional array so that I can manipulate (copy, sort...) them:
 
1 3 12 63
83 10 19 14
21 34 87 54 

I've found on this and other forums how to read the txt, but no solutions how to remove all these unwanted lines.
I'm reading the file so:
 
string
[] lines = System.IO.File.ReadAllLines(@"E:\Task\myfile.txt");

Thanks for your help
Kabanga
 

Answers (4)