10-12-2012
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear Sir;
i want to know how the binary data convert to text file or readablw format (ASCII).If possible pl. help me for the software and where it is available for download. i.e. (1 Reply)
Discussion started by: auro123
1 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
I have a print control file (dflt) for Oracle which is in binary. As I am going to develope an application in Window environment, I would like to reference the dflt file. But it is in binary format and I cannot access it. Anyone can suggest me how to convert the file into text or... (5 Replies)
Discussion started by: user12345
5 Replies
3. Programming
Hi All,
Please suggest me how to read a binary file in text or ASCII format.
thanks
Nagendra (3 Replies)
Discussion started by: Nagendra
3 Replies
4. Shell Programming and Scripting
im looking for anothr way to convert binary file into text file
im using old solaris version (exatcly like xxd -r)
thanks (2 Replies)
Discussion started by: modcan
2 Replies
5. Shell Programming and Scripting
Hi
I need to create multiple text files from onc text file on AIX. The data of text files is as below:
**********************************************
**********************************************
DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009
Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies
6. AIX
:confused:
Hi there
I have a requirement to create a variable block binary file on AIX.
Once the file has been feed with info , the file needs to be ftp to MVS.
The problem experienced; when transferring the file to MVS.
MVS does not pick up the carriage return line feed, which OA OD
... (0 Replies)
Discussion started by: Luke21
0 Replies
7. Shell Programming and Scripting
Hello *nix specialists,
Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies
8. UNIX for Dummies Questions & Answers
Hi,
Im wondering how I can convert a binary file to a text file?
I have ran the following command to output which type of binary file coding it is
od -t x1 -c eHat.data0 | head -20
and that gives me the following output;
0000000 5c 00 00 00 cd 06 f2 41 00 00 00 c6 00 00 00 c6 \ \0 \0 \0... (3 Replies)
Discussion started by: dp0b
3 Replies
9. UNIX for Beginners Questions & Answers
Hi
i have a problem in my job
i try to convert an excel file (xls extention) to text file (tab delimited), but no result with this comand
cat xxx.xls > xxx.txt
Do you have eny idea?
PS: sorry for my english
Thanks!! (4 Replies)
Discussion started by: frisso
4 Replies
10. Shell Programming and Scripting
Hello all,
I have a txt file containing millions of lines. Below is the example:
{tx:be} head -50 file.txt
Instr1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Instr1:... (6 Replies)
Discussion started by: Zam_1234
6 Replies
LEARN ABOUT REDHAT
mimetypes
fileutil::magic::mimetype(n) file utilities fileutil::magic::mimetype(n)
__________________________________________________________________________________________________________________________________________________
NAME
fileutil::magic::mimetype - Procedures implementing mime-type recognition
SYNOPSIS
package require Tcl 8.4
package require fileutil::magic::mimetype ?1.0.2?
::fileutil::magic::mimetype filename
_________________________________________________________________
DESCRIPTION
This package provides a command for the recognition of file types in pure Tcl. The output is standardized to mime-types.
The core part of the recognizer was generated from a "magic(5)" file containing the checks to perform to recognize files, and associated
mime-types.
::fileutil::magic::mimetype filename
This command is similar to the command fileutil::fileType.
The output of the command for the specified file is not a list of attributes describing the type of the file, but a list of standard
mime-types the file may have.
This list will be empty if the type of the file is not recognized.
REFERENCES
[1] File(1) sources [ftp://ftp.astron.com/pub/file/] This site contains the current sources for the file command, including the magic
definitions used by it. The latter were used by us to generate this recognizer.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category fileutil
:: magic of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may
have for either package and/or documentation.
SEE ALSO
file(1), fileutil, magic(5)
KEYWORDS
file recognition, file type, file utilities, mime, type
fumagic 1.0.2 fileutil::magic::mimetype(n)