From: James Masters Date: 2009-09-19T11:15:09+09:00 Subject: Re: Determining if a file is binary or text On Sep 18, 5:12 pm, Seebs wrote: > Basically, stop and think what you *mean* by "binary or text".  Once you've > articulated that more clearly, you may well have a much better notion of what > you mean. How about a file that contains any single byte character (0-255) that you cannot find a key for on a standard US keyboard (English)? The [:print:] regular expression character set comprises the range of characters 32-126, which is what I believe that I need, but I wanted to see if there are better ways to accomplish this. Basically I'm trying to search for the presence of a header in source code files (which may have various extensions or no extensions at all). The source code files are mixed with executable and non- executable "binary" files (data files; not something that you can read). I don't want to flag the non-source code files as not having a header. The scope of this problem is small so I don't need to worry about any character sets, etc. I realize that this can be a complicated problem to solve, but there are solutions to it. For example, the Linux "file" command is a robust solution but does not meet my needs for the previously stated reason. I also know that SVN can automatically detect binary files as well. Hopefully this helps clear things up... Thanks, -James