2012-05-24 Grep Woes

As I am working on the last issues for my new Oddmuse release, I’ve stumbled upon a strange problem using grep scenario on Mac OS 10.6.8:

Oddmuse

$ mkdir /tmp/dir
$ echo schroeder > /tmp/dir/schroeder
$ echo schröder > /tmp/dir/schröder
$ echo SCHRÖDER > /tmp/dir/SCHRÖDER-UP # don't use SCHRÖDER because of HFS
$ grep -rli schröder /tmp/dir
/tmp/dir/schröder
$ grep -rli SCHRÖDER /tmp/dir
/tmp/dir/schröder

Why is grep not finding the upper case variant in the *Schröder-Up* file?

$ cat /tmp/dir/schröder | od -c
0000000    s   c   h   r   ö  **   d   e   r  \n
0000012
$ cat /tmp/dir/SCHRÖDER-UP | od -c
0000000    S   C   H   R   Ö  **   D   E   R  \n
0000012

Maybe related in a weird way: HFS uses Normalization Form D. I’ll try on my new Debian system.

Normalization Form D

​#OSX ​#grep