On Fri, 30 Jul 2004, Andrew Gaffney wrote:
I think it is a problem with the regex. If I change it to:
grep -RLi '<%init>' * | grep '.html'
I get all files that don't have '<%init>', but it doesn't work with the '<%(init|perl)>'. That regex doesn't seem to match anything.
More man page material: I was using `egrep` for the earlier examples, not `grep`. On my computer (a Mac), `egrep` is equivalent to `grep -e`; either way, this pulls in an enhanced regex parser that, in this case, is being used to match multiple patterns (by|doing|this).
Hence, these two lines are equivalent:
egrep 'pattern|anotherpattern' * grep -e 'pattern|anotherpattern' *
Also, the line you ended up with --
grep -RLi '<%init>' * | grep '.html'
-- should be equivalent to this one --
grep -RLi '<%init>' *html
-- without needing the second grep statement.
It isn't though. I had the '-R' flag in which means I want it to search subdirectories also. The '*html' gets interpreted by the shell and it ends up not recursing.
And to weave the multiple pattern matching back in, you can do these:
egrep -RLi '<%(init|perl)>' *html grep -RLie '<%(init|perl)>' *html
I ended up with "egrep -RLi '<%(init|perl)>' * | egrep '.html$'" which seems to get me exactly what I wanted.
Both of these should match files that have neither of the two patterns you were asking about: /<%init>/ nor /<%perl>/ .
Make sense?
Yes. Thanks for the help.
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>