Subject: Re: Where to get regexp help?
To: netbsd-help <netbsd-help@netbsd.org>
From: David S. <davids@idiom.com>
List: netbsd-help
Date: 01/20/2003 14:35:43
> 
> I have a text file that contains a report.  Each entry spans
> multipal lines.  I need to grab two different substrings out of each
> record.  How do a create a regexp string that can do that?  The only
> catch is that the number of lines per record is unknown.
> 
> Example: (I need to get all the name's and zip's)

If below is indeed representative of your data files, you don't need
regular expressions to extract the names and zip codes.  'strtok' and
'strcmp' (or maybe 'strcasecmp') should be sufficient.  Read their
respective man pages.

David S.

> 
> i---------
> Name: Mike Wilson
> Address1: 123 NetBSD Drive
> City: BSD
> State: UNIX
> Zip: 98754
> i---------
> Name: Barbara Carson
> Address1: 851 NetBSD Ave
> Address2: Ste 300
> City: BSD
> State: UNIX
> Zip: 65324
> Phone: 1-212-555-1212
> Fax: 1-212-555-1313
> 
> Sam