Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best Way to Write File to Extract Data

Status
Not open for further replies.

newtofortran31

Technical User
Jan 20, 2014
1
US
Hi All,

I have a bunch of text files in the following format that are all over 10,000 lines long. I only want to pull out the data starting after the line that ends 3 1 3. I only want two arrays, one being [1.000000-5 5.029911-4 3.567310-3 9.500160-3 etc.] and the other being [2.022625+3 2.961525+2 1.190999+2 9.500160-3 etc.] One complication is that there is no space between the last number I am interested in (in each line) and the '8925'

NOTE: I cannot get the columns to line up in this format, but they are lined up in the text file

....continued.....
0.000000+0 0.000000+0 0 0 0 08925 0 0 0
8.922500+4 2.230900+2 0 0 0 08925 3 1 1
0.000000+0 0.000000+0 0 0 1 1198925 3 1 2
119 5 8925 3 1 3
1.000000-5 2.022625+3 5.029911-4 2.961525+2 3.567310-3 1.190999+28925 3 1 4
9.500160-3 7.786903+1 2.530000-2 5.260050+1 5.195710-2 4.052419+18925 3 1 5
....continued.....

My first thought is to just search for the "3 1 3" line then start reading in numbers, and then use formatting statements to read in the last number in scientific notation (ignoring the 8925)

I am definitely a programming novice and I just wanted to get a sense of the best strategy to start out with. Thanks.
 
There are several theads in this forum about extracting data from a file.
You can search for an example code and try to adjust it for your purpose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top