grep

Ian Mortimer ian at physics.uq.edu.au
Tue Jan 18 01:54:59 UTC 2005


On Tue, 2005-01-18 at 03:06, Brian D. McGrew wrote:
> I'm having an issue with grep on Fedora Core 3.  Historically on SunOS,
> Solaris and RedHat 7.3 we've always used grep 2.2.  However, Fedora Core
> 3 comes with greg 2.5.1 and it doesn't seem to work anymore and can't
> figure out why.

> The line:
> 
>  
> 
> $GREP -B1 '^[A-z][A-z0-9]*[     ]*(\(.*\))' 
> 
>  
> 
> Is what's causing us problems.  I don't know much regex but I've traced
> it down to that one line.  Can someone tell me how to make this work
> with grep 2.5.1?

This is the RedHat list not the Fedora list!

The problem might be with unicode.  

The regex is wrongly constructed anyway `A-z' should be `A-Za-z'. 
(Even though A-z works in ascii - with a few extra characters
thrown in - it's not going to work in every language locale).

To see if unicode is the problem you could try this:

   export LC_ALL=C

then run your script.  (Or put the line at the top of your script).

-- 
Ian




More information about the redhat-list mailing list