Hi all,

I need to search text files for a given expression and flag a warning/
error if that expression does not exist.  I'm going to search a large
number of files using the Linux "find" command, so I won't know if
they are binary or text.

I realize that this can be OS-dependent and can be tricky to
determine.  I was going to use the Linux "file" command which works
well in providing human-readable information about the file; however,
due to a variety of possible file types, I cannot easily determine the
file type without specifying every single possible text file format to
consider.  For example, the "file" command can produce the following
(all of which are ASCII):

ASCII text
XML document text
Lisp/Scheme program text
...

Is there an easy way to do this in Ruby?  After looking around quite a
bit, I thought about looking at a few first lines of the file and
matching against this regular expression:

# Character class:
# [:print:] Any printable character, including space
line.match(/^[[:print:]]+$/)

Which I believe could work.  Any comments?

Thanks,
-James