Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #894

Re: Find / Grep Question

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.unix.programmer
Subject Re: Find / Grep Question
Date 2011-07-07 17:22 +0100
Message-ID <87k4bucb7v.fsf@sapphire.mobileactivedefense.com> (permalink)
References <4e15d020$0$29268$c3e8da3$10cdda79@news.astraweb.com> <87oc16cda0.fsf@sapphire.mobileactivedefense.com> <4e15d513$0$4528$c3e8da3$460562f1@news.astraweb.com>

Show all headers | View raw


Martin Crouch <spamspamspam@spaml.com> writes:
> On 07/07/2011 16:37, Rainer Weikusat wrote:
>> Martin Crouch<spamspamspam@spaml.com>  writes:
>>> I can find all files containing the string "dir" in a directory (and
>>> subdirectories) by doing the following:
>>>
>>> find . | xargs grep -ils dir
>>>
>>> However how can I do the reverse?  i.e. Find all the files that do not
>>> contain the string "dir".   Sounds simple, but I haven't found an easy
>>> way yet.
>>
>> find . | xargs grep -vils dir
> Thanks.
>
> Unfortunately that doesn't seem to work as the files have other
> content in (they are more than one line)

Sorry, I misread that. If you have GNU grep, you could use -L instead
of -l:

[root@quicksand]/etc #grep --help | grep -- -L
  -L, --files-without-match print only names of FILEs containing no match

Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Find / Grep Question Martin Crouch <spamspamspam@spaml.com> - 2011-07-07 16:26 +0100
  Re: Find / Grep Question Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-07-07 16:37 +0100
    Re: Find / Grep Question Martin Crouch <spamspamspam@spaml.com> - 2011-07-07 16:47 +0100
      Re: Find / Grep Question Mc <spam.mc@gmail.com> - 2011-07-07 16:49 +0100
      Re: Find / Grep Question Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-07-07 17:22 +0100
      Re: Find / Grep Question John Gordon <gordon@panix.com> - 2011-07-07 16:28 +0000
  Re: Find / Grep Question Bjarni Juliusson <bjarni@update.uu.se> - 2011-07-07 19:06 +0200
    Re: Find / Grep Question wfw <wyatt@cfa.harvard.edu> - 2011-07-07 21:59 -0700
      Re: Find / Grep Question wfw <wyatt@cfa.harvard.edu> - 2011-07-07 22:01 -0700
    Re: Find / Grep Question wfw <wyatt@cfa.harvard.edu> - 2011-07-07 22:14 -0700
      Re: Find / Grep Question Martin Crouch <spamspamspam@spaml.com> - 2011-07-08 10:04 +0100
  Re: Find / Grep Question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-10 15:35 +0100

csiph-web