Loading default info by parsing incoming text

Animull

New member
Joined
Feb 24, 2006
Messages
1
Programming Experience
Beginner
I'm a little new to VB. How do I parse an incoming text file and load default information from another file, and then save that information to another file? An example would be like this:

[text file]
/GL99-SWITCH-LIST WX510 04/13 0948
SWITCH LIST: 03 JOB-ID: YCY21R 13 LEAD-ID: WL
YARD 01 TRACK 014 DIR W CUT-ID:


SEQ INIT NUMB LKND YBLK TRK SPCD CNTNT *NEXT*SYS*DES*CONSIGN OBND-TRAIN TBLK SQ

001 CNW 178434 EC4T GRVR 020 H2 WX817 MCYPC 13 GRVR 01

002 UP 077034 EC4T GRVR 020 H2 WX838 MCYPC 13 GRVR 02
[end]
Now what I'm trying to do is take the incoming text file, parse out the Header part with the track number(i.e. TRACK 014) and make that the default save name with a different format, as in going fro ".txt" to something like ".lrt". I also am trying to parse out a certain section such as in EC4T. I want to take the last 3 char, and with them specify which new file to open to populate the new file with. I'm currently at a lose as I have never tried anything like this before. Any help would be greatly appreciated.
 
I noticed you joined the forum Feb 2006; are you still using .NET 1.1?
You would do the same steps regardless of the framework version, but you would use different classes as the newer frameworks have much improved file manipulation.

The answer would depend on whether the text file would always follow the same structure as shown. If it does always have the same structure (the different section are of the same length) then it is simple string manipulation. Read the file into a string (or string array, or collection ...) then manipulate it using appropriate methods.
 
Back
Top