first, using
-q and and
-L together seems a bit nonsensical.
-L tells
grep to print filenames that don't match, but
-q supresses the output.
Also, you seem to be confusing
standard output of the program and its
return code. The && operators depend on the latter, while
-L affects the former.
So, if the file
does contain the first pattern,
grep returns 0 and the next
grep is executed. If, however, the first pattern is
not included,
grep prints nothing because of the
-q switch and returns 1, which means the tests for the other patterns are not executed.
Also, you are running the
greps in a loop, but the
-L switch makes most sense when executed with multiple filenames to list those that don't match.
So, some possibilities:
Code:
grep -L "PBAH\|SKOW\|CGRA" *.fas
or, if you have more patterns, you can use the
-f switch. so , if your patterns are in file
patterns, one per line:
Code:
grep -L -f patterns *.fas
should work. There's plenty of variations, but I hope this will get you started.