[NTLUG:Discuss] perl question

Bobby Wrenn bjwrenn at augustmail.com
Wed Jun 4 11:38:21 CDT 2003


On Wed, 2003-06-04 at 11:00, MadHat wrote:
> On Wed, 2003-06-04 at 10:43, Bobby Wrenn wrote:
> > On Wed, 2003-06-04 at 09:52, Michael Patrick wrote:
> > > On Wed, Jun 04, 2003 at 09:49:02AM -0500, Bobby Wrenn wrote:
> > > > I have a text file in the following format:
> > > > 
> > > > name1
> > > > [name2]
> > > > address1
> > > > [address2]
> > > > city, state [zip]
> > > >
> > > 
> > > How is the next record done?  Is there a space between them so you could read each line then we you hit a blank line you'll know city, state [zip] was the preceding line?
> > > 
> > > Michael 
> > > 
> > Each line is terminated with a <cr>. There are no blank lines between
> > records,
> 
> Unless you can guarantee that the name field will never have a comma (,)
> and you can guarantee that the city/state field will, you are in a
> pickle.
> 
> Like is someone is 'Richard Cranium, Jr', then you couldn't use the
> existence of the comma to determine the end of each record.  Or even
> matching on a word followed by a comma then 2 characters.
> 
The file will come from a M$ Excel spreadsheet. I can jerk the text out
and make sure there are no commas. Then I think I can look for a space 2
alpha characters and a new line and stick a comma back in after the
city. Then the only problem is to get rid of everything but the line
with city state and zip.




More information about the Discuss mailing list