I'm not really sure how to word it, if it is possible, but part of my program reads from a text file. It then pulls out the necessary information needed from that file by finding key identifiers. Right now the code is written to find the first key identifier and then read each line after that, locating each subsequent identifier and pulling the data from it. In a few cases, the format examples I've worked with are a bit different which results in a runtime error. How can I tell the program to essentially skip that part of the text file if it's not reading it right and continue moving on? Here is somewhat of an example of the text file.
DID/"DATA EXTRACTED HERE"
NAM/"DATA EXTRACTED HERE"
STR/"DATA EXTRACTED HERE"
CTY/"DATA EXTRACTED HERE"
Sometimes there is an extra space in between each line or in a few cases, the line below is not even there. For the ones with spaces, I added a do loop to keep looking for that line and have had no problems, but I would rather the information for that individual item not be pulled from the text file while still reading the rest of it.