I am trying to configure a grep command that searches for my current directory but excludes the directory only if it is the root directory.
So, for the following directories, I want # 1 to be excluded and # 2 to be included
1) vendor/phpunit 2) app/views/vendor
First I started with the command below
grep -Ir --exclude-dir=vendor keywords *
I tried using ^ vendor, ^ vendor /, ^ vendor /, ^ vendor, but nothing works.
Is there any way to do this with grep? I tried to try to do this with a single grep call, but if I need to, I can pass the results to a second grep.
source share