Quote:

could you explain what you meant by "or prefix the data with a sentinel string"




Keyword.

Your Fax and Telephone details can be determined because the lines start with the FAX: and TEL: keywords respectively. I've used the FAX: keyword in the example script to trigger the write of the output line to the CSV file.

The persons name can be determined (assuming it is always present) because it is the last entry before the telephone number.

The (first line of) the address can be determined because it is the first line after the FAX: line.

However, there is no way of determining what the rest of the stuff is.

There are some heuristic tricks and patterm matching which you can use to guess what a line may be, but that's a substantial task and it won't always get it right.

Can the program you are exporting the data from present it in a different way?