so my input file would be something like:
words words nothing important
words words nothing important
the quick brown fox 23
the quick brown fox 14
words words nothing important
words words nothing important
now, I'd like to be able to grab the 1st instance of "fox" and capture the "23" in WS-FIRST then grab the second instance of "fox" and capture "14" in WS-SECOND.
I'll be replacing "the quick brown fox" with a different string as well, but it's the same on both lines, so pretty easy.
The text is fixed in content and fixed in position and the number is also fixed in content, position and length.
Your problem sounds like it would be well suited by a finite state machine or a simple parser. This sounds like homework, so I won't write the code for you, but I'll offer some hints that might point you in the right direction.
So a main look might look like:
I hope some of that helps.