From: Seebs Date: 2009-09-19T09:40:08+09:00 Subject: Re: Determining if a file is binary or text On 2009-09-18, James Masters wrote: > 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. This question is not well defined. Think about UTF8 and ISO-8859-1... 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. Would you be expecting to not see this message in a "binary" file? If so, why are they different? What about binary files makes them not need the message (or what about text files makes them not need it...)? If you mean "executables", you might approximate decently by checking the execute permission bit... -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!