[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "grep -o" skips some matching patterns
From: |
Stepan Kasal |
Subject: |
Re: "grep -o" skips some matching patterns |
Date: |
Thu, 1 Jan 2004 13:04:26 +0100 |
User-agent: |
Mutt/1.4.1i |
Hello,
thank very much to Michael for the explanation, which helped.
I'd like to add a theoretical comment which won't help at all ;-)
On Tue, Dec 30, 2003 at 04:24:23PM +0100, Roberto Gordo Saez wrote:
> $ echo abc0111def | grep -o "[01]*"
This command should in fact print seven lines, three empty ones,
then the non-empty match and another three empty ones.
The reason can be explained by the following (the sed command performs
global substitution of your regex by "(...)"):
$ echo abc0111def|sed 's/[01]*/(&)/g'
()a()b()c(0111)d()e()f()
So you have actually triggered a bug in ``grep -o''.
I hope to help with fixing it...
Stepan Kasal
- Re: "grep -o" skips some matching patterns,
Stepan Kasal <=