first, using -q
and and -L
together seems a bit nonsensical. -L
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
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 grep
s 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:
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:
grep -L -f patterns *.fas
should work. There's plenty of variations, but I hope this will get you started.