yamid

yamid

  • NA
  • 98
  • 0

Read a text file _including some column based data in c#

Oct 15 2009 3:23 PM
The data file is as follows which includes 1. a description line(starts with *SUMMARY of...*) 2.The names of each column 3.four lines which are not needed to be read(they may include some numbers but we donot care) 4.few space lines(not known how many-we should skip them-) 5. and the data columns respresentative of each name(in line 2).
I want to read each column of data into an array with the name in line 2.
--note: 1. The begining of each section is started with string "SUMMARY" which helps that after this line the data should be read. Before SUMMARY string there may be an empty line.
--note: 2. If there a name-like DATE or CPR- is repeated we should change the name to DATE1,DATE2,.. and CPR1,CPR2,...
--note: 3. All Data EXCEPT *DATE* are of type DOUBLE so all data are type DOUBLE except the columns for DATE.

I wonder if it is it possible to to" look for one the data column once a time" represent each name. for example I want to look for data corresponding to CPR2[] or COPR2[],... once a time. I mean each time I need an array, it should opens the text file and searches for that specific name and obtain the data column needed.
For example if I need CPR2, it searches for second CPR find in the file an read the corresponding data.


Well, it is becomming quite long, sorry for that. I wonder is someone kindly helps.



------------------------------------------------------------------------
...
SUMMARY OF RUN contineous_shale
DATE FLPR WOPR WOPT WWCT WLPR WTHP WOGR WGPR WWPR
STB/DAY STB/DAY STB STB/DAY PSIA STB/MSCF MSCF/DAY STB/DAY
WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A


01-JAN-2000 0 0 0 0 0 0 0 0 0
01-JAN-2000 1004.796 980 0.0098 0.024678 1004.796 0 2.857143 343 24.79598
...
SUMMARY OF RUN contineous_shale
DATE COPR CPR CPR CPR CPR CPR CPR CPR CPR
STB/DAY PSIA PSIA PSIA PSIA PSIA PSIA PSIA PSIA
WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A WELL-A
28 28 25 28 28 1 28 28 2 28 28 3 28 28 4 28 28 5 28 28 6 28 28 7 28 28 8

01-JAN-2000 0 2389.568 2391.734 2393.899 2396.064 2398.23 2400.396 2402.56 2404.728
01-JAN-2000 46.57573 2341.398 2343.578 2345.758 2347.938 2350.117 2352.297 2354.477 2356.656
01-JAN-2000 46.79882 2336.025 2338.204 2340.383 2342.562 2344.74 2346.919 2349.098 2351.277
01-JAN-2000 46.92634 2331.071 2333.25 2335.429 2337.608 2339.786 2341.965 2344.144 2346.322
...

--------------------------------------------------------------------------

Answers (3)