From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1348 invoked by alias); 19 Jul 2005 16:22:00 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 1263 invoked by uid 22791); 19 Jul 2005 16:21:56 -0000 Received: from pp.dundee.ac.uk (HELO pp.dundee.ac.uk) (134.36.2.60) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 19 Jul 2005 16:21:56 +0000 Received: from tcgp.dundee.ac.uk ([134.36.204.2] helo=tcgpfdxp) by pp.dundee.ac.uk with esmtp (Exim 4.43) id 1Duupd-0001ZO-Sq; Tue, 19 Jul 2005 17:21:54 +0100 Reply-To: From: "fergus" To: Cc: Subject: OT: grep for \x00 = NUL Date: Tue, 19 Jul 2005 16:22:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-UoD-Scan-Signature: f90e409be92b202c9976479b4cc982a2 X-SW-Source: 2005-07/txt/msg00868.txt.bz2 Message-ID: <20050719162200.vOkWFpahy7z7dehxgmj4qpjUPZBbiJcC8kF3SIyO4w8@z> Sorry, probably off topic but so tantalising and so easily stated I thought I'd try you. Using grep to locate hex characters in files I've used the syntax grep $'\x0d' # e.g. equivalent to grep "^M" grep $'\x1a' # e.g. equivalent to grep "^Z" and found this to work for all \x01 to \xff, that's 255 of the 256 one might be interested in looking for. (Well, I haven't tried them all, but a lot of them.) What I still can't do (actually, what I most wanted to do) is search for the NUL \x00. Nothing in info bash indicated that this approach would not work for \x00, but as far as I can tell, it doesn't: files that do not contain \x00 are listed as containing it (try grep $'\x00' *). Is it a bug? Any ideas? (This has cropped up before but sorry I can't seem to find it. Various suggestions included piping output from od to grep, but this approach just involving grep seems much more direct if it can be made to work.) Fergus -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/