[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug or feature?
From: |
Eric Cloninger |
Subject: |
Re: Bug or feature? |
Date: |
Thu, 23 Jun 2011 08:43:41 -0500 (CDT) |
Here's what I've got:
Bug not present:
grep-2.5.3-6.fc12.x86_64
grep-2.6.3-1.fc12.x86_64
Bug present:
grep-2.5.1-54.2.el5
grep-2.5.1-55.el5
grep-2.5.1-57.fc7
----- Original Message -----
From: "Eric Blake" <address@hidden>
To: "Eric Cloninger" <address@hidden>
Cc: address@hidden
Sent: Wednesday, June 22, 2011 5:43:20 PM
Subject: Re: Bug or feature?
On 06/22/2011 04:25 PM, Eric Cloninger wrote:
> # echo " 1 2 3 4" |grep -o "^ [0-9]"
> 1
> 2
> 3
> 4
>
> It would appear that -o chops up the input stream into a new line every time
> a match is found. However, I expect a "^...." grep to find only one result
> per line of input, regardless of the return method (whole line or
> only-matching). Bug or feature?
Which version of grep?
$ echo " 1 2 3 4" | grep -o '^ [0-9]'
1
$ grep (GNU grep) 2.8
and likewise for 2.9.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org