bug-gnu-utils
[Top][All Lists]
Advanced

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

grep "binary"


From: Vlad Kudelin
Subject: grep "binary"
Date: Tue, 3 May 2005 13:27:27 -0700 (PDT)

    Hi,

the following two commands were issued in a directory containing a
couple hundreds of subdirectories, each containing a file called
"txt.txt".

% grep ^'PATT ' */txt.txt |wc -l
   9333
% cat */txt.txt | grep ^'PATT '  | wc -l
  12198

The mistery gets solved after carefully comparing two outputs. In the
1st command, *some* files are treated as binary, hence instead of
strings grep prints a "Binary file matches..." message.

(Needless to say that all my files are equally "TEXT", with some utf-8
characters).

Would be nice to have the "Binary matching" feature documented in more
details.
 * "If the first few bytes of a file indicate that the file contains
binary data, ...."

 * "By default, under MS-DOS and MS-Windows, grep guesses the file type
              by looking at the contents of the first 32KB read from
the file."

don't help too much. Especially if one works under UNIX.

Thanks,

    Vlad.


Do Yahoo You?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]