X-Spam-Check-By: sourceware.org Date: Tue, 26 Sep 2006 08:41:50 -0400 From: "Kenneth Nellis" Subject: RE: grep weirdness - matching space character In-reply-to: <11329.194.203.201.98.1159265802.squirrel@www.yankeeboysoftware.com> To: Message-id: <002001c6e169$23de3a60$be32000a@idirect.net> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 11 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Because "\d" is a Perl-specific feature, you should specify "grep -P". -----Original Message----- From: The Blog User [mailto:blog at yankeeboysoftware dot com] Sent: Tuesday, September 26, 2006 6:17 AM To: cygwin AT cygwin DOT com Subject: grep weirdness - matching space character 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 ? $ tail -1 /path/to/file/the.log | grep -a "All...\d*.items succeeded" I tried '.*' before I looked at the binary values, and got a match, then I reverted to '...' by trial and error. This seems wrong to me, since - from my knowledge of regex's - that is saying there must be three characters between the 'All' and the first digit, yet I can see there is only a single space character. VERSION Information $ uname -a CYGWIN_NT-5.1 gbws-00027514 1.5.21(0.156/4/2) 2006-07-30 14:21 i686 Cygwin $ bash --version GNU bash, version 3.1.17(6)-release (i686-pc-cygwin) $ grep --version grep (GNU grep) 2.5.1 $ tail --version tail (GNU coreutils) 5.97 -- 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/