I am not sure what you are doing but you may want to instead search the directories you want with find instead of using locate.
Am 08. Mär, 2015 schwätzte joe@actionline.com so:
moin moin Joe,
I don't see an exclude option for locate, so you probably want to use the
-v option for grep. -v says to show anything that doesn't match the
pattern.
$ echo anke | grep -v fred
anke
$
$ echo 'anke
fred' | grep -v fredanke
$
BTW, the man page says -y is an old synonym for -i, so you might want to
use -i rather than -y unless you have a compatability issue somewhere.
ciao,
der.hans
How can I exclude a specified directory (or perhaps more than one)
from a 'locate' search for files containing a certain name or word
on my system?
For example, I frequently now use the following:
$ locate filename | fgrep -ya "/home/joe" <E>
How could I modify that to exclude all files with the specified
filename in one (or more) specified subdirectories?
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss
--
# http://www.LuftHans.com/ http://www.PhxLinux.org/
# "It is a miracle that curiosity survives formal education."
# -- Albert Einstein
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss