[AIX] Binary file warning for text file. | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

[AIX] Binary file warning for text file.

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 10-12-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 22 August 2014, 2:59 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,192
Thanks: 44
Thanked 796 Times in 627 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 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
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



All times are GMT -4. The time now is 07:36 PM.