Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!reed!kab From: kab@reed.bitnet (Kent Black,L08,640,7754072) Newsgroups: comp.unix.wizards Subject: Re: Bug in grep -i ? Summary: Yes, yes, yes: BSD derived bug Message-ID: <13800@reed.UUCP> Date: 26 Dec 89 23:03:13 GMT References: <1989Dec25.210118.7946@phri.nyu.edu> Sender: news@reed.UUCP Reply-To: kab@reed (Kent Black) Organization: Reed College, Portland, OR Lines: 46 In article <1989Dec25.210118.7946@phri.nyu.edu> roy@alanine.phri.nyu.edu (Roy Smith) writes: > > Is there any reason, other than a bug, why the following two >commands (extracted from a history list) should give different output? > > 122 15:51 grep -i 'N:.*SIRIUS' yalerem.txt > 123 15:51 grep -i 'n:.*sirius' yalerem.txt > No. Bsd derived bug that refused to go away until ~BSD4.[2-3]; I thought old bsd-grep folded upper case in the pattern onto lower case, but not lower to upper (but see below): e.g., $ grep -i KENT /reed/etc/passwd kab:irAbYvOt4zBKQ:238:20:Kent Black,L08,640,:/u/v/kab:/bin/csh $ grep -i kENT /reed/etc/passwd $ $ grep -i KeNt /reed/etc/passwd kab:irAbYvOt4zBKQ:238:20:Kent Black,L08,640,:/u/v/kab:/bin/csh I fixed it on our vax and may have remembered backwards; patch is trivial. The bug is slowly being eradicated. Grep works as documented on at least More BSD4.3 (VAX) (and, I presume, 4.3-tahoe) SunOS 4.0 (Sun3/60) Ultrix UWS2.0 (DECstation 3100) Bug still exists for BSD4.[1-2] NeXT 1.0 (they actually reversed the behaviour, unless I've misremembered nexttues> nidump passwd . | grep -i kent kab:J5o2F5X1fbYAY:238:20:Kent Black:/u/kab:/bin/csh nexttues> nidump passwd . | grep -i KENT nexttues> Now isn't that special ;-) UTEK 4.0 (tek4317) (also reversed the behaviour) Sales Pitch: (except that it isn't for sale) Gnu grep (ggrep) has always been correct, besides which it is public domain, much faster than 4.3-grep on our vax (pointless comparison for any files I had handy on the 3100: lots of zero's ;-), has context printing (lines before, after or both), emacs-style word matching and 6 g'zillion other neat things. Use it instead, if you can. -- kab