[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep options -i and -o don't work together
From: |
Stephen White |
Subject: |
grep options -i and -o don't work together |
Date: |
Fri, 11 Feb 2005 11:49:17 +0000 |
User-agent: |
Mutt/1.4.1i |
Options -i and -o don't work together as one would expect.
Create a file containing 'foo' and 'FOO' on different lines. 'grep -i
foo' will (correctly) find both occurances.
'grep -io foo' will not.
This problem was discovered using grep 2.5.1, but I have
confirmed that the problem still exists in grep-2.5.1a.
The attached patch nearly fixes this by reusing code from the colour
output option - however there is a slight bug with that code.
If the match expression is not all in lower case then the colour
matching code doesn't work, and therefore neither does my fix.
ie. 'grep -io fOo' still doesn't work properly, nor does 'grep -io FOO',
but 'grep -io foo' does. I almost included code to run the match
expression through a lowercasing function if (match_icase &&
(color_option || only_matching)) before grep does it's work but thought
that was a bit hacky, and not knowing all of the grep code I wasn't sure
if it would have unwanted side effects.
Stephen
--
Stephen White +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
grep.caseonlymatch.patch
Description: Text document
- grep options -i and -o don't work together,
Stephen White <=