bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug or feature?


From: Eric Blake
Subject: Re: Bug or feature?
Date: Wed, 22 Jun 2011 16:43:20 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]