Grep --exclude-dir (root directory only) -


i'm trying setup grep command, searches current directory, excludes directory, if it's root directory.

so following directories, want #1 excluded, , #2 included

1) vendor/phpunit 2) app/views/vendor 

i started below command

grep -ir --exclude-dir=vendor keywords * 

i tried using ^vendor, ^vendor/, ^vendor/, ^vendor, nothing seems work.

is there way grep? looking try 1 grep call, if have to, can pipe results second grep.

with pipes:

grep -ir keywords * | grep -v '^vendor/' 

the problem exclude-dir is, tests name of directory , not path before going it, not possible distinguish between 2 vendor directories based on depths.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -