Dan Widyono on 15 Dec 2004 23:00:21 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] procmail/egrep/digits question


> Any reason why?

Ohhhh, you wanted an *explanation* as well?  :)

This is definitely one of those 'teach a man to fish, don't give him a fish'
moments.  Regular expressions are to be learned from ground up, IMHO.  This
method goes for anyone interested in learning RE's, be they POSIX, grep, ed,
sed, awk, perl, bash, etc.  And yes, you need to check with *each*
*program's* man page before assuming RE's are interpreted the same among all
of them.  They aren't, at least not 100% (homework: find the difference
between awk and egrep, so far I've only seen it in the code and in the
O'Reilly book on sed and awk, it *might* be buried in the man pages; I've
been bitten by it already).

First thing to do is read through the egrep man page, RE section.  You
probably already have done this, given that you created some form of RE.

> > > \@*[[:digit:]]
> > \@.*[[:digit:]]

Next, convert your RE into english step by step, left to right.  Then do the
same for mine.  Do _not_ just look at the one difference between the two RE's
and look up the meaning of that, RE's are context-sensitive.

If you have any specific questions, I'd be glad to follow up offline.

Dan W.
-- 
-- Daniel Widyono             --
-- www.widyono.net            --
-- www.cis.upenn.edu/~widyono --
-- 
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug