[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep bug
From: |
Dave B |
Subject: |
Re: grep bug |
Date: |
Mon, 11 May 2009 23:58:21 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090420) |
Erickson, John wrote:
> The following grep returns no matches:
>
> echo " hello" | grep -o '\w*'
>
> whereas if I omit the leading spaces, it will return the match.
>
> This seems to be a bug.
>
> This is GNU grep 2.5.1
\w* matches the empty pattern, which is at the beginning of the string
(before the space). You probably want \w\+ or \w\{1,\}
--
D.