GregLocock
Automotive
- Apr 10, 2001
- 23,367
I have an ongoing need for a program that will read in a text file and deconstruct it so that the important numerical results can be extracted and dumped into a spreadhseet.
For example
Some header stuff
Run 17
Number of widgets 16
Volume 8.3, 4.7
lots of stuff of variable length that I don't need that may include numbers
Run 18
Number of widgets 19
Volume 8.7, 5.6
followed by lots of other stuff I don't need that may include numbers
Would produce the output
17
16
8.3
4.7
18
19
8.7
5.6
only. The file to drive this would just contain "Run" and 4, ie give me the next 4 numbers after you see the phrase Run.
Obviously I can sort of do this by pulling it into excel, but it tends to be fragile and need a lot of customising.
Is there a general purpose solution to this - I'm guessing a database? I should point out that the files are very variable in length and the order in which things occure, but each segment that I am interested in is of a regular structure.
Cheers
Greg Locock
SIGlease see FAQ731-376 for tips on how to make the best use of Eng-Tips.
For example
Some header stuff
Run 17
Number of widgets 16
Volume 8.3, 4.7
lots of stuff of variable length that I don't need that may include numbers
Run 18
Number of widgets 19
Volume 8.7, 5.6
followed by lots of other stuff I don't need that may include numbers
Would produce the output
17
16
8.3
4.7
18
19
8.7
5.6
only. The file to drive this would just contain "Run" and 4, ie give me the next 4 numbers after you see the phrase Run.
Obviously I can sort of do this by pulling it into excel, but it tends to be fragile and need a lot of customising.
Is there a general purpose solution to this - I'm guessing a database? I should point out that the files are very variable in length and the order in which things occure, but each segment that I am interested in is of a regular structure.
Cheers
Greg Locock
SIGlease see FAQ731-376 for tips on how to make the best use of Eng-Tips.