regexp matching question

Peter plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Wed Oct 5 16:41:09 UTC 2005


On Wed, 5 Oct 2005, Tony Abou-Assaleh wrote:

> If you would like to 'grep' a mailbox file and extract messages containing
> some RE, the easiest and fastest way I know of is using cgrep from the
> University of Waterloo.
>
> I have a link to the source code + a report that shows how to do the above
> at:
>
> http://www.cosc.brocku.ca/~taa/greps.html
>
> Using regexec might not be the way to go because it requires the entire
> string to be in memory. If you want to deal with large strings (stored in
> files) properly, then you'd be reinventing the grep program, so just look
> at the source code instead.

Ok, thanks.

I wanted to use regexec because I intend to process the data in the 
message but you may be right. Having the whole string in memory is not 
really necessary. I have implemented a function that has a suitably
large 'window' on the file open in memory. I have also looked at the 
formail program source, which does what I need but it very hard to 
understand.

Peter
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list