OK guys/gals stuck again on something simple
I have a text file which has multiple lines per entry, the data is in the following format
firstword word word word
wordx word word word interesting1 word word word word
wordy word word word
wordz word word word interesting2 word word word lastword
this sequence repeats a hundred or so times, all other words are the same apart from interesting1 and interesting2, no blank lines. The interesting2 is pertinent to interesting1 but not to anything else and I want to link the two interesting items together, discarding the rest such as
interesting1 = interesting2
interesting1 = interesting2
interesting1 = interesting2
etc, 1 lne per sequence
Each line begins with a different word
my attempt was to read the file and do an "if wordx in line" statement to identify the first interesting line, slice out the value, find the second line, ("if wordz in line) slice out the value and concatenate the second with the first.
It's clumsy though, I had to use global variables, temp variables etc, and I'm sure there must be a way of identifying the range between firstword and lastword and placing that into a single list, then slicing both values out together.
Any suggestions gratefully acknowledged, thanks for your time