bug-grep
[Top][All Lists]
Advanced

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

Re: grep bug report: --only-matching fails


From: Tony Abou-Assaleh
Subject: Re: grep bug report: --only-matching fails
Date: Sat, 29 Sep 2007 22:33:14 -0300 (ADT)

Thanks for the report. The version you are using is grep-5.2.1. Many bugs
related to the -o option have been fixed in the latest release grep-5.2.3.

I have tried a few cases and they all worked as expected:

--
% ./grep --version
GNU grep 2.5.3

Copyright (C) 1988, 1992-2002, 2004, 2005  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
% echo 'abc1234abc' | ./grep '[1234567890]*'
abc1234abc
% echo 'abc1234abc' | ./grep -o '[1234567890]*'
1234
--

Note that under most shells you should use quotes around the pattern if
you specify *, otherwise the * is interpreted by the shell. For example:

--
% echo 'abc1234abc' | ./grep -o [1234567890]*
tcsh: ./grep: No match.
--

Cheers,

TAA

-----------------------------------------------------
Tony Abou-Assaleh
Email:    address@hidden
Web site: http://tony.abou-assaleh.net
----------------------[THE END]----------------------

On Fri, 28 Sep 2007, address@hidden wrote:

> When trying to match a repeated character class, the match works when
> using grep with no arguments, but the match fails when using -o (show
> only the matching pattern).  I've attached grepbug-cli.txt, which
> demonstrates the bug, and the input file I used,
> grepbug-onlymatching.txt.  I even tried throwing on perl support with
> -P, because I know character classes are defined in this way with Perl
> regular expressions.  Also, adding quotes around the match pattern
> makes no difference.
>
> Thanks.
>




reply via email to

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