Open-Source Software Shortcut, Excluding Directories From Grep
Mar 30, 2010, 22:33 (0 Talkback[s])
(Other stories by Juliet Kemp)
Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
"I work on a project on which I regularly want to grep the
directory tree for a particular word but without including the cvs/
and doc/ directories. Happily, grep has an exclude-dir option to do
grep -R --exclude-dir=cvs --exclude-dir=doc foo *
"It searches recursively for foo without looking in cvs/ or
doc/, so the output isn't clogged up with unwanted results.
"The problem with this is that (in true sys admin style) I'm
lazy and don't want to do all that typing. One solution to this is
to set up an alias in the ~/.bashrc file:"