In my opinion, and this does sound like homework to me, Q1 should have files 1 & 2 as answer, whereas Q2 should have all of the files as answer.
OR is not the same as XOR (exclusive OR).
In standard logic, the operations AND, OR and XOR are defined as follows:
c1 - c2 - c1 AND c2 - c1 OR c2 - c1 XOR c2
F - F - F - F - F
T - F - F - T - T
F - T - F - T - T
T - T - T - T - F
So, in short, "AND" yields "T" (true) if both conditions (c1 and c2) are met at the same time.
"OR" yields true if either or both of the conditions is true.
"XOR" yields true if either of the conditions is true, but not both.
Since Q2 asks for "OR", not "XOR", all three files have either "aaa" or "bbb" (or both) in them.
As your command for Q2 yielded none of the three files, I suspect your command is wrong.
And indeed: you are asking grep to match either "aaa" or "bbb". If either is found in the file, the file is considered as "file with match". -L only shows the files that don't match.
So, replace -L with -l and you should get all the files that match "aaa" or "bbb".
|