File command return wrong filetype while file holds group separator char.

hi,

I am trying to get the FileType using the File command. I have one file, which holds Group separator along with ASCII character.
It's a Text file.

But when I ran the File command the FileType is coming as "data".

It should be "ASCII, Text file".

Is the latest version of File command support Group separator as ASCII char?

How to get the correct file type of this file using the File or any other command ?

What kind of ASCII text contains group separators? That sounds more like control codes than text.

Pls post a hexdump of your file or attach a sample.

I wouldn't rely on the "file" command to provide any definitive answer about the intended use or format of a file. It's notoriously inaccurate and IMO is more of a "hint" for interactive use then anything else.

Hi,
The ASCII code for group separator is 29. I have used this particular character to separate out two words. Actually it's a text file, holding all text data. Hence it should show as ASCII Text file by the file command. But it's recognized as data file due to group separator 29.
Please help me to find out a way, so that it could be recognized as Text file.

Hi.

The definition of how file decides on filetype is:

     The type printed will usually contain one of the words text (the file
     contains only printing characters and a few common control characters and
     is probably safe to read on an ASCII terminal), executable (the file con
     tains the result of compiling a program in a form understandable to some
     UNIX kernel or another), or data meaning anything else (data is usually
     �binary' or non-printable).  Exceptions are well-known file formats (core
     files, tar archives) that are known to contain binary data.

from man file, q.v.

One could create one's own file command and add the GS control character as an exception -- I have not done it, but I think the file magic could be so changed. Otherwise, one could replace the GS (say with sed) to something innocuous before feeding the resulting copy of the data file to the file commend.

Best wishes ... cheers, drl

So you used a nonprinting char as a separator and wondered why file considered it to be nonprinting. Either configure file to your liking, or, don't do that...