From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,8201736d5a4793eb,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-11-10 07:03:53 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-han1.dfn.de!news.gwdg.de!not-for-mail From: Helge Preuss Newsgroups: comp.unix.tru64 Subject: Strange grep behavior Date: Mon, 10 Nov 2003 16:02:31 +0100 Organization: GWDG, Goettingen Message-ID: NNTP-Posting-Host: theopc48.rz-berlin.mpg.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: gwdu112.gwdg.de 1068476632 13252 141.14.132.2 (10 Nov 2003 15:03:52 GMT) X-Complaints-To: news@gwdg.de NNTP-Posting-Date: Mon, 10 Nov 2003 15:03:52 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.unix.tru64:10900 Hi, a colleague of mine complained to me that grep does not print lines matching the search expression in some of his files, giving the message "binary file foo.txt matches". Now his files are just plain old text files. What is even stranger, if he renames that file, grep prints the matching lines. Now I was not able to reproduce this behavior, but I found a different unexpected behavior: grepping for a string in a binary file, which i know it exists, two times out of three (different strings) it does not find the search string. The third time, it just prints the string. No line number, no mention of a binary file eiteher. So my questions: Is this behavior known, maybe even documented? More generally, how does grep determine whether a file is a binary? The OS in case is Tru64 5.1a. TIA Helge -- hint: my first name is not "spam"!