in reply to Define string on current line, then match other lines with string below the line

Your interior while loop runs to the end of the file. You need to seek back to the point you found your last match (assuming they always come in groups) to find the next string to search for. It looks like you could use the number of elements in the first line to know how many lines to search.

1 Peter 4:10
  • Comment on Re: Define string on current line, then match other lines with string below the line