Scripting question ...

der.hans PLUGd at LuftHans.com
Sun Mar 8 10:36:47 MST 2015


Am 08. Mär, 2015 schwätzte joe at 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 fred
anke
$

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 at 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


More information about the PLUG-discuss mailing list