Parse irregular data, dump into delimited text file

d_at_rren.cymraeg.org
Date: 11/27/05


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 :

name|address|postcode|telephone

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.

Darren

-- 
Aberdare Blog   http://blog.aberdare.org/  Only Blog In The Valley


Relevant Pages

  • Insert fails on access that I know works...
    ... I use PHP to write my form data to MySQL. ... I have a database with about ten tables. ... Message: Access denied for user: '@localhost' to database 'myDatabase' ... address1, address2, city, postcode, country, email, website, type) VALUES ...
    (comp.lang.php)
  • Use of Distinct ?
    ... simply pulls information from a database and displays it on screen. ... eliminate the duplicate entries when it displays it on screen. ... few other fields such as name and address1. ...
    (comp.lang.php)
  • Re: mail merge address book
    ... Can I create a database with Name, address1, city, state, zip. ... and use that or do I setup addresses and one block and use that or what? ...
    (microsoft.public.word.newusers)
  • Re: Message from code gear
    ... Looking closer, the Company name is now shown in Address1... ... I think somebody screwed up the database. ... find someone that does that sort of thing. ...
    (borland.public.delphi.non-technical)