Parse irregular data, dump into delimited text file
Date: 27 Nov 2005 18:10:59 GMT
I've been given an MS Word document containing information to input into
a database. I've knocked it into shape using various unix tools eg.
sed, cut etc. so now I have data in a plain text file like this :
The address field contains data in an irregular form, eg.
12, the high street, town, place, biggerplace
The vicarage, town place
I need to be able to format address field above ready for importing
into another database. In this new database, I have 3 fields for
address (address1, address2, address3).
So my problem is how to cut this address data and then put it back in a
text file with delimiter. address3 should contain only one word,
however, address1 and address2 may contain more than one word. When
filling in the fields, data should be added from left to right, or in
the order address1 then address2 then address3. If there is an address
field left with a blank, that is not a problem as it will be handled by
the mailmerge software.
Help on this much appreciated.
-- Aberdare Blog http://blog.aberdare.org/ Only Blog In The Valley