Find files that have words in common

view full story

http://unix.stackexchange.com – What would be the best way to create a list of files that have common words with a given file. For example, if I had: $ ls mainFile file1 file2 file file4 $ cat mainFile exquisite malicious sentient pulsating perspicacious one tawdry fumigate Baryshnikov O'connor and I wanted to list any of the files in the cwd that contained any one of the words in mainFile. What would be the best way to go about this? Since the number of words per line in mainFile is not constant, I was finding solutions using cut a little tricky. I was trying to create a string out of the words and then place (HowTos)