Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Text file analyser 3

Status
Not open for further replies.

GregLocock

Automotive
Apr 10, 2001
23,767
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

SIG:please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Replies continue below

Recommended for you

Greg,

see: thread227-233088 someone has written yet another compiler compiler.

TTFN

FAQ731-376
 
Thanks, link's busted, well, it certainly is not a rare question. Incidentally my immediate problem was solved with matlab.

Cheers

Greg Locock

SIG:please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
I think I saw that link and dismissed it as a selling link.

One day though, I'll have enough spare time to sxplore yacc.

- Steve
 
Oh, sorry, he must have gotten RF'd. I don't think he was selling, per se, since both his program and source code were downloadable.

I'll have to look that home for the download.

TTFN

FAQ731-376
 
The RF wasn't from me, honest. Even though I may have inadvertently put my hand. And I meant explore (is sxplore a Freudian slip??).

- Steve
 
Not if it's about software; then, it's just plain perverse.

TTFN

FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor