[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a grep question



* Craig Dickson (crdic@yahoo.com) [020305 16:13]:
> When searching only a single directory, without its subdirectories, you
> probably don't really need find; it would do as well in most cases just
> to redirect grep's stderr to /dev/null, like this:
> 
>    grep "pattern to seach for" files 2>/dev/null
> 
> (assuming you are using a reasonable shell, i.e. not csh, which as I
> recall cannot redirect stderr). This gets rid of grep's silly complaints
> about "x is a directory" for every subdirectory.
> 
this works, too, to skip the garbage printed by trying to read
directories:

grep -d skip "pattern" files

the -d skip (or -dskip) tells grep to skip over the directories instead
of trying to read them.

good times,
Vineet

-- 
Currently seeking opportunities in the SF Bay Area
Please see http://www.doorstop.net/resume/

Attachment: pgpczJyVmlDVE.pgp
Description: PGP signature


Reply to: