[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to convert files



John Hasler wrote:
> FuziOK writes:
> > I'm not clear how to use command file to detect binaries.
>
> Use it to detect DOS files.  From the man page:
>
>     If the lines of a file are terminated by CR, CRLF, or NEL, instead of
>     the Unix-standard LF, this will be reported.
>
> Or parse file's output for the identifier for your binaries, if they are of
> predictable types.
>
> What is the problem you are trying to solve?
> --
> John Hasler

Thanks for your response.

In fact, I am puzzled with binary files and text files:
How can I say a file is a binary file, not a text file?

Example:

$ (cat /bin/ls; echo '#!/bin/sh') > aaa
$ file aaa
aaa: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 
2.4.1, dynamically linked (uses shared libs), for GNU/Linux 2.4.1, stripped
$ flip -m aaa
aaa: binary file, not converted

$ (echo '#!/bin/sh'; cat /bin/ls) > bbb
$ file bbb
bbb: Bourne shell script text executable
$ flip -m bbb
bbb: binary file, not converted

From the example, I think, at least, 'file' is not suitable tool to dectect 
binary files. 



Reply to: