From owner-freebsd-questions Sat Jan 2 23:07:15 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA21310 for freebsd-questions-outgoing; Sat, 2 Jan 1999 23:07:15 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from guru.phone.net (guru.phone.net [209.157.82.120]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id XAA21298 for ; Sat, 2 Jan 1999 23:07:14 -0800 (PST) (envelope-from mwm@phone.net) Received: (qmail 1979 invoked by uid 100); 3 Jan 1999 07:06:50 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Jan 1999 07:06:50 -0000 Date: Sat, 2 Jan 1999 23:06:50 -0800 (PST) From: Mike Meyer To: freebsd-questions@FreeBSD.ORG Subject: Re: grep binary files under xterm In-Reply-To: <368F12D7.5F793D50@mx.cei.gov.cn> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 3 Jan 1999, Peihan Wang wrote: > I also tried some binary files while using grep. If > the file contains the searching string, xterm window > becomes a mass. But this will not happen in console > mode. > > How could I tune something to correct it ? You can't - asking for "lines" from a binary file tends to produce garbage. Try the strings command on the file, and grep'ing the output instead: strings /etc/pwd.db | grep root is canonical, but may not be what you want.