1

I am getting different output while using file command in AIX vs Linux.

File contents :

D|P_APAC_PH_PHINGTF00240_20150731031225|APAC|PH|NN (L) SPEK DYWIDENDOWYCH RYNKÓW WSCHODZCYCH||4|20130308|PHN|PHN|1145050.06|1145050.06|301893.026||||ING|ING|PHINGTF00240|ISIN|||||||||||||||||||||||||

file output:

LINUX : ISO-8859 text
AIX : ascii text

I can see one accented letter O in the file. Is it the reason for the different output?

1
  • Different implementation; the spec doesn't dictate that level
    – Jeff Schaller
    Commented Apr 9, 2016 at 11:07

1 Answer 1

3

The Ó is probably why file on your Linux box is saying ISO-8859 text, but the reason why the file output is different is because your Linux box and your AIX box have different magic databases for file to work with.

AIX almost certainly has an ancient, obsolete magic db. Linux machines tend to have reasonably up-to-date ones with identifier sequences for many more kinds of files.

6
  • Thanks....Can u specify the exact entry which i have to check in /etc/magic file Commented Apr 9, 2016 at 14:21
  • @GAURAVMAHAJAN You should be using utf-8 across all your systems and forget about "character sets".
    – user79743
    Commented Apr 9, 2016 at 18:52
  • The difference may be simply that file on Linux looks at a bigger part of the file than on AIX. file guesses the file format based on the content, it doesn't have access to any metadata that would tell it the file encoding, it's possible that the AIX version looks at a smaller part of the file so it only sees the ASCII characters at the beginning. @GAURAVMAHAJAN Commented Apr 9, 2016 at 23:15
  • you can test @Gilles theory by creating a much smaller text file, with Ó in the first few characters and then running file on that.
    – cas
    Commented Apr 10, 2016 at 0:18
  • @BinaryZebra - does AIX, and its versions of standard tools, support UTF-8?
    – cas
    Commented Apr 10, 2016 at 0:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.