Text analysis program? (Beginner challenge).

MagicSam

Junior Member
Feb 17, 2013
1
0
0
Hey guys,

First off, I have absolutely no programming experience or background whatsoever.

I set myself a goal recently of being to program a challenge an IT teacher set a friend of mine a few months ago, and I would really appreciate it if some of those with the necessary skills and experience could provide me with a "path" I can follow to be able to program it.

I have in my possession a large text file which I wish to analyse.

The file is in the following format

xxxxxxxxxxx 1240 xxxxxxxx
xxxxxxxxxxx 1345 xxxxxxxx
xxxxxxxxxxx 1658 xxxxxxxx

Essentially, I want to isolate the numbers in each line, and track them, triggering different actions when a certain number is hit. For example, if it hits 1240, the program would do a track it, or something of that nature, and when it reaches another specified number, say, 4356 it stops the pair, and then logs that one complete pair has been recorded.

So, my question to you, is where do I start to be able to do this?

I understand that this may be far more complex than I think it to be, but I aim to use this to learn some programming skills over the mid-term future, and a platform to expand my knowledge.

Thanks for your time,
MagicSam
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
1) figure out how to open data file
2) read file
3) parse the line read in
4) analyze the parsed result
5) process based on #4
6) go to #2 or #3 depending on how you read file
 

BRcr

Junior Member
Feb 14, 2013
12
0
0
Those x-characters you typed - are they really present in file strings or there is something else?
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,582
4,494
75
Where you want to go may depend on how complicated the actions are for each number. If they're very complicated, you may want to look at Yacc or its relatives.

This is one of those times I wish I'd taken that compiler construction class in college.
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
There are two types of text datafiles. Fixed-width and delimited. Your file could be either space-delimted, or fixed-width. That is the first thing you have to figure out.
 

ikachu

Senior member
Jan 19, 2011
274
2
81
It sounds like something that'd be pretty easy to do with Perl and regular expressions...

I feel kind of dirty suggesting Perl to anyone though so I'm sure any language with regex support could do this pretty easily.