a question about GREP
Ben Scott
dragonhawk at gmail.com
Tue Mar 27 09:51:05 EDT 2007
On 3/27/07, Jerry <greenmt at gmail.com> wrote:
> You are right. Some files on our server which I believe are plain text files
> turn out to be "data", based on what "file" command shows.
The "file(1)" command just looks at the contents of a file, and
looks for known patterns (also called "magic numbers"). For example,
all GIF image files being with the characters "GIF89". So it looks
for patterns like that, and "guesses" at what the file is supposed to
be. There isn't any actual "file type" metadata stored in a standard
*nix filesystem.
> Weird! These files were moved from AIX system to the current Red Hat system,
> could this have something to with the file type?
It's more likely they happen to contain some "characters" which are
outside the strict ASCII standard printable character set (A-Z, a-z,
0-9, space, keyboard punctuation). For example, maybe it contains
some so-called "high ASCII" (8th bit set), which isn't a standard at
all, but various platform-specific and mutually-incompatible
extensions to ASCII.
Older versions of the file(1) command would probably identify a
UTF-16 encoded Unicode text file as "data".
-- Ben
More information about the gnhlug-discuss
mailing list