How to pasre parts of file

I can't get myhead around this one. I have a file of information, from which I need to pick relevant bits. And put these relevant bits into a datebase.

=====xxxxx xxx xxx=======

REF xxxxxxxxxxxxxxxxxxxxx

HEADER xxxxxxxxxxxxxxxxxxx

SOURCE xxxxxxxxxxxxxxxxxx

AUTHOR xxxxxxxxxxxx

xxxx xxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx

xxxx xxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx

xxxx xxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx

xxxx xxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx

xxxx xxxxx xxxxxxxxxxxx xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxx

*there are some random numbers here*

# Cy Caa Cz F1 F2 F3 .......... ZZ

1 3 a s - xx xx xx ......... xx

2 4 a v B xx xx xx ......... xx

3 5 a d S

4 6 a g -

5 7 a w T

this is the type of file I am trying to parse. There is only certain limited information I need from this file.

The first few lines contain junk and need to be discarded

It is only the numbers in the '#' list that I require, which generally would be starting from one anyway, so easily could be put in an array.

Cy is required, Caa is required, and Cz is required, although sometimes Cz doesn't have a quantity so it could be null. And the rest of the info in F1 F2 F3 etc., is junk and needs to be discarded.

Now I am not looking at you guys to do my homework. All I am wanting to know is what to use to pick out just the relevant bits, and how?

Any sort of help will be much appreciated. Please. Thanks a lot.

[1620 byte] By [shiraztfda] at [2007-10-2 9:11:32]
# 1
Read the file contents line-by-line using FileReader, and parse that line using StringTokenizer.Use can also you String class indexOf() methodand extract a word or two from the file.For more information see the Java API documentation.Good luck.
JGuru23a at 2007-7-16 23:18:35 > top of Java-index,Other Topics,Algorithms...