delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/26/09:46:19

X-Spam-Check-By: sourceware.org
Date: Tue, 26 Sep 2006 09:46:10 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: grep weirdness - matching space character
Message-ID: <20060926134610.GA28890@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <11329 DOT 194 DOT 203 DOT 201 DOT 98 DOT 1159265802 DOT squirrel AT www DOT yankeeboysoftware DOT com>
Mime-Version: 1.0
In-Reply-To: <11329.194.203.201.98.1159265802.squirrel@www.yankeeboysoftware.com>
User-Agent: Mutt/1.5.11
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Tue, Sep 26, 2006 at 11:16:42AM +0100, The Blog User wrote:
>I am really struggling to understand what I am doing wrong here.
>
>I have a log file with a line that looks like this:
>
>++ 04:51:32 All 94 items succeeded
>
>The binary data for that line is this:
>
>2B 2B 20 30 34 3A 35 31 3A 33 32 20 41 6C 6C 20 39 34 20 69 74 65 6D 73 20
>73 75 63 63 65 65 64 65 64 0A
>
>using grep and tail (versions below) I am failing to match that line
>
>$ tail -1 /path/to/file/the.log | grep -a "All \d*.items succeeded"
>
>however if I insert 3 (why three?) dots (or a .*) between 'All' and '\d' I
>get a match, what is happening ?

grep doesn't recognize \d as matching a number so it is not going to do
what you think it does.  All...  will skip over the 94 above and match
zero occurrences of \d so that's why that works.

Use [0-9]* instead of \d.

cgf

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019