Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: egrep bug

0 views
Skip to first unread message

Tom Hageman

unread,
Nov 4, 2009, 7:46:46 PM11/4/09
to Jonathan Bronson, bug-gn...@gnu.org
Hi Jonathan,

In article <mailman.10013.1257294...@gnu.org>, you wrote:
> Hi,
>
> I have grep/egrep version:
> Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There
> is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
>
> for snow leopard. When i type the phrase:
>
> cat /usr/share/dict/words | egrep --color '([aeiou][^aeiou]*){8}'
>
> it should return every dictionary entry with 8 vowels. It does this on
> my linux machine and my labmate's linux machine, but not on my mac or
> on any other mac I've tried it on. Thanks,
>
> Jon

Seems to work on Mac OS X (Tiger) 10.4.11, except for the --color bit;
--color=always does colorize the match (red) though:

$ cat /usr/share/dict/words | egrep --color '([aeiou][^aeiou]*){8}' | head -15
abdominoanterior
abdominoposterior
aceanthrenequinone
acetabuliferous
acetoacetanilide
acetoamidophenol
acetobromanilide
acetotoluidine
acetylenediurein
achroiocythaemia
Achromobacterieae
acinacifolious
acousticolateral
acromioclavicular
acromiocoracoid

Actually your pattern matches words with 8 vowels -or more-, since it is
not an anchored match. Also it counts only lowercase vowels, so any
8-vowel word with one or more upper-case vowels is missed. If you only
want words with exactly 8 vowels you could use:

$ cat /usr/share/dict/words | egrep -i '^[^aeiou]*([aeiou][^aeiou]*){8}$'
| head -15
abdominoanterior
abdominoposterior
acetabuliferous
acetoamidophenol
acetobromanilide
acetotoluidine
acetylenediurein
achroiocythaemia
Achromatiaceae
acinacifolious
Acipenseroidei
acousticolateral
acromioclavicular
acromiocoracoid
acrotrophoneurosis

$ cat /usr/share/dict/words | egrep '([aeiou][^aeiou]*){8}' | wc -l
2019
$ cat /usr/share/dict/words | egrep -i '^[^aeiou]*([aeiou][^aeiou]*){8}$'
| wc -l
1705

$ egrep --version
egrep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Regards,
--Tom.


0 new messages