Chris Devers wrote:
On Fri, 30 Jul 2004, Andrew Gaffney wrote:

Chris Devers wrote:

On Fri, 30 Jul 2004, Andrew Gaffney wrote:

Then yes, I misunderstood. This version should do what you want:

$ find /path/to/htdocs -type f | xargs egrep -liv '<%(perl|init)>'


That still doesn't appear to do what I want. I believe it is showing me all files where *all* lines don't contain '<%perl>' or '<%init>'. Since not *all* lines contain either one of those, all files still show in the list.


Okay, let's try again then:

  $ grep -li '<title>' *html  # print all html files with '<title>'
  20things.html
  bookmarks.html
  gas.html
  gas_form.html
  itunes.html
  noise.html
  $

  $ grep -Li '<title>' *html  # print all html files WITHOUT '<title>'
  HEADER.shtml
  $

The sets are non-intersecting, and so apparently what you meant.

If you want to refine this further, try `egrep --help` or `man egrep`.
I should have tested what I sent before sending it, but ten seconds of skimming over the documentation on your own should have been enough to show you these lines from `egrep --help`:


  $ egrep --help | grep -i 'files.*match.*print'
    -L, --files-without-match only print FILE names containing no match
    -l, --files-with-matches  only print FILE names containing matches
  $

So, as with many Unix commands, shift-L inverts the usual sense of L, meaning that '-L' gets you the opposite of what '-l' does.

Now have we got it? :-)

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.

--
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>




Reply via email to