in reply to Questions about Grep

As others have pointed out, grep in Perl and grep in various flavors of Unix are not the same. Further, there can be interesting variations in the kinds of patterns that different versions of (Unix) grep can handle (grep, egrep, fgrep, etc).

Certain versions of Red Hat had a grep that accepted the -P flag, which then would allow the pattern to be a Perl style regular expression. I personally found it useful to be able to say things like:

grep -P "(199|200)\d\w+" my.mail.log

Replies are listed 'Best First'.
Re^2: Questions about Grep
by graff (Chancellor) on May 30, 2008 at 02:01 UTC
    (shameless plug:) I seriously needed a command-line grep tool that could do real perl regexes, so I wrote one: grepp -- Perl version of grep -- it even handles encoding conversions and unicode expressions. (I know others have done similar exercises, but it's hard to resist doing it yourself...)