I would like write an applescript to evaluate whether a particular file contains a specified string (perhaps as part of an if... then statement). I want to invoke a shell command using mdfind to do this and I am aware of how to restrict mdfind to find files containing a specified string only in specified directories:
mdfind -onlyin /Users/viktor/Desktop/ nintendo
This command will find all files containing the string "nintendo". Is it possible to somehow query a file rather than a directory? And return true / false or the file itself to indicate that the string is in the text content of the file? Putting a file name after "-onlyin" does not work of course...