bug-grep
[Top][All Lists]
Advanced

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

Re: grep: -i option not working i cronjobs


From: Tony Abou-Assaleh
Subject: Re: grep: -i option not working i cronjobs
Date: Thu, 11 Nov 2004 22:16:10 -0400 (AST)

If I remember correctly, the way -i is implemented is by converting the
searched buffer and the regular expression to lower case, doing the
search, and the outputting the 'converted' buffer snippets that match.

I can see at least 2 possible approaches:

1) Have 2 buffers, original and TOLOWERCASE'ed, and when printing the
output, print it from the original buffer
2) convert the regular expression to match both cases for any literals
simply by expanding each alphabetic symbol to a character class of it's
lowercase and upper case forms: e.g, 'a' -> '[aA]', 'B'-> '[bB]', etc.

My guess is that for most cases, the second solution would be faster. But
that's just a semi-educated guess at the moment. Does anyone know better?

Cheers,

TAA

--------------------------------------------------
Tony Abou-Assaleh
Ph.D. Candidate, Faculty of Computer Science
Chair of the Dalhousie Student Chapter of the ACM
Dalhousie University, Halifax, NS, Canada, B3H 1W5
Fax:   902-492-1517
Email: address@hidden
WWW:   http://www.cs.dal.ca/~taa/
---------------------[THE END]--------------------


On Thu, 11 Nov 2004, J. W.Andersen, Falster System Teknik wrote:

> Julian:
>
> FYI, I found yet another bug in grep/fgrep/egrep:
>
> When -i and -o options are used at the same time, the greps always outputs
> the searched text i LOWERCASE ! This was not exactly whar I was looking
> for, the whole idea was to get the filename as it was passed, so that I
> could
> rename it to what I wanted.
>
> So untill further I gave up the various greps and wrote a rather primitive
> mini-grep just for my purpose - compared to grep it processes only one
> file, and the only option known is -i. Not glamorous, and not very
> sophisticated, but it does work for my purpose !
>
> Cheers, Joe.-
>
> ++++++++++++++++++++++++++++++++++
>
> Julian Foad wrote:
>
> > J. W.Andersen, Falster System Teknik wrote:
> >
> >> I have retrieved SuSE's source pack for the actual grep. As my C
> >> skille are pretty rusty (have not used them much
> >> for the past 10 years ), I am somewhat uncertain as to where to begin
> >> and where to end. Could you maybe
> >> give a hint as to which of the source modules are of primary
> >> interrest for this issue ?
> >
> >
> > Look for "only_matching" and "match_icase" in src/grep.c.
> >
> > If you are willing to help fix this, please go to the GNU Savannah
> > project home page for Grep, at https://savannah.gnu.org/projects/grep/
> > and check out the latest source code from CVS, and in the bug and
> > patch databases there you will find things like a previous attempt to
> > fix it, and some tests for this behaviour.
> >
> > We will be glad to discuss your ideas and progress on this mailing list.
> >
> > - Julian
>
>
>
>




reply via email to

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