Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

[AIX] Binary file warning for text file.

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-12-2012
EnioMarques EnioMarques is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 6 November 2012, 2:24 PM EST
Location: Brazil
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
[AIX] Binary file warning for text file.

Hello guys,

We had to move from a DC to another, and we are now facing an "issue" with some text files.

Looks like that some of our log files are set as binary:

file TuxConnectorURA.20121012
TuxConnectorURA.20121012: data or International Language text


less TuxConnectorURA.20121012
"TuxConnectorURA.20121012" may be a binary file. See it anyway?

but I can see it normally after pressing "y"


My question is... is there a way to correct it? Will it causing any impact? (I'm afraid that non-log files are with such problem).


Thanks a lot!
Sponsored Links
    #2  
Old Unix and Linux 10-12-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 10 December 2016, 5:54 PM EST
Location: In the leftmost byte of /dev/kmem
Posts: 5,247
Thanks: 90
Thanked 1,378 Times in 1,034 Posts
Unix file recognition is steered by a file called "/etc/magic". It contains rules for what has to be in a file to make it a file of type x. It works like "if a file has an 'x' as the 12th byte and a 'y' as one of the first 3 bytes than it is ...". As this is ultimately best-guess its outcome can be wrong sometimes. This may be the case with your file for reasons unknown.

Issue "file /path/to/your/logfile" to find out which type the system thinks it is (the "file" utility bases its outcome on the same mechanism). You can even correct the type database in "/etc/magic" by putting in new entries - see "man /etc/magic" for details how to do so.

It is also possible that your file contains some unprintable characters "less" filters out, which make "file" think it is binary. In this case you probably should correct your logging mechanism because writing hex characters in a log file is wrong.

I hope this helps.

bakunin
Sponsored Links
    #3  
Old Unix and Linux 11-06-2012
EnioMarques EnioMarques is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 6 November 2012, 2:24 PM EST
Location: Brazil
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Sorry for the long delay to respond.

Looks like after the logs rotated, they went back to normal. It's happening only after the server boot, but get to work properly after it rotates.

Thanks!
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
convert binary file into text file modcan Shell Programming and Scripting 2 12-29-2008 10:28 AM
Reading a binary file in text or ASCII format Nagendra Programming 3 12-03-2008 06:11 PM
How to convert binary Unix file to text user12345 UNIX for Dummies Questions & Answers 5 11-10-2006 06:53 AM
Binary data to text file conversion auro123 UNIX for Dummies Questions & Answers 1 12-26-2005 06:48 AM



All times are GMT -4. The time now is 05:54 AM.