Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jan 1999 23:06:50 -0800 (PST)
From:      Mike Meyer <mwm@phone.net>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: grep binary files under xterm
Message-ID:  <Pine.BSF.4.05.9901022305270.11212-100000@guru.phone.net>
In-Reply-To: <368F12D7.5F793D50@mx.cei.gov.cn>

next in thread | previous in thread | raw e-mail | index | archive | help


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.

	<mike



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901022305270.11212-100000>