Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.programmer > #895
| From | John Gordon <gordon@panix.com> |
|---|---|
| Newsgroups | comp.unix.programmer |
| Subject | Re: Find / Grep Question |
| Date | 2011-07-07 16:28 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <iv4mrn$73c$1@reader1.panix.com> (permalink) |
| References | <4e15d020$0$29268$c3e8da3$10cdda79@news.astraweb.com> <87oc16cda0.fsf@sapphire.mobileactivedefense.com> <4e15d513$0$4528$c3e8da3$460562f1@news.astraweb.com> |
In <4e15d513$0$4528$c3e8da3$460562f1@news.astraweb.com> Martin Crouch <spamspamspam@spaml.com> writes:
> Unfortunately that doesn't seem to work as the files have other content
> in (they are more than one line) so I'm assuming those lines get listed
> by the -v option and so the file gets shown even though the file does
> contain "dir".
Grep only cares about *lines* of text. (Even after using unix for many
years, I have to remind myself of this fact every so often.)
The -l option is not shorthand for "evaluate the contents of the file
as a whole"; it is shorthand for "print only the filename instead of all
the matching lines."
As a result the -v and -l options tend not to work well together, because
most files will have some lines that don't contain the target text, and so
grep happily reports them.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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