Package: grep
Version: 2.5.1.ds2-6
Severity: wishlist

hi,

at first it lokked like a bug, but then after digging into the docs I'm 
rating it a wishlist item.

Seems that grep fails on simple basic regex:

% echo -e '\t0000\t:ris'|egrep '^\t0000'

fails, yet it should clearly match. Eg.:

% echo -e '\t0000\t:ris'|agrep '^\t0000'
        0000    :ris

with agrep from tre-regex.
But even agrep seems broken here:

% echo -e '\t0000\t:ris'|agrep '^[ \t]0000'

fails. [ \t] would be [:blank:] and with that both *grep work.

Also fail:

% echo -e '0000\t:ris'|egrep '^0000\t'
and
% echo -e '0000\t:ris'|egrep '^0000[ \t]'

Funny is, that sed (4.1.5) works:

% echo -e '0000\t:ris'|sed 's/^0000[ \t]\(.*\)/\1/'
:ris

and pcregrep (4.3, PCRE 6.7) is fine on all of above:

% echo -e '\t0000\t:ris'|pcregrep '^\t0000'
        0000    :ris
% echo -e '\t0000\t:ris'|pcregrep '^[ \t]0000'
        0000    :ris
% echo -e '0000\t:ris'|pcregrep '^0000[ \t]'
0000    :ris

manpage doesn't mention escapes like \t, POSIX states that 
"The interpretation of an ordinary character preceded by a backslash (\)
is undefined."
though I'd expect grep and sed agree on RE, and rather have support in grep
for the usual escapes (other than the RE specials, that is) like sed and 
pcregrep. 


thanks
--
paolo



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to