Hi all,
first I'd like to describe the problem I'm facing:
I have about 1,900 Microsoft Word documents, that I converted to text files. I want to search these files for multiple keywords. I found a solution for grep that is able to perform an OR search. But I have to combine it with AND so the command lists all of these documents that contain two or more key words.
I've been searching a lot on this topic, but haven't found a solution. As far as I understand it, grep takes no more than one keyword or expression at once. One more problem with grep is, that it is line-based, but I want to search complete files. I don't need the line number or the sum of all occurances in a file.
My thoughts are going in two directions:
1) is there an alternative to the grep command that is able to handle to search for multiple keywords natively?
2) With grep I could output the names of all files, that contain one special keyword, one by one for each relevant keyword. Is there an utility I could use to get the intersection of multiple outputs? Maybe I should give you an more precice example:
# cat output-1 -------- keyword A occures in these files
file-a.txt
file-b.txt
file-d.txt
# cat output-2 -------- keyword B has been found in these files
file-a.txt
file-c.txt
file-d.txt
file-e.txt
So to ask again, is there an utility that could retrieve the intersection of these two files, i. e. "file-a.txt" and "file-d.txt"?
Of cource I would also appreciate a third or fourth solution
Cheers,
titopoquito