> % echo foo.c | 9 grep '*\.c'

correct.  match \.c as a literal string.  there is no match.

> % echo foo.c | 9 grep '*.c'
> foo.c

correct.  match .c as a littal string.  there is a match.

> % echo fooxc | 9 grep '*.c'
> %
> % echo fooxc | 9 grep '.*.c'
> fooxc

correct.  match 0-n any character then 1 any character then a c.  there is a 
match.

> % echo fooxc | 9 grep '.*\.c'

correct.  this time there's no match because '.' is treated as a literal not
a pattern.

> % echo foo.c | 9 grep '.*\.c'
> foo.c

correct.  match 0-n any characters, then a literal '.' then literal 'c'.  there 
is a match.

> % echo foo.c | 9 grep '*foo.c'
> foo.c

correct.  match the literal string foo.c.  there is a match.

remember that the match doesn't have to be anchored by default, so i sometimes
do this
        grep $somesym `{find /sys/src|grep '\.[chys]$'}
this is also packaged up in the local version of 'g'; this would be equivalent
        g $somesym /sys/src

- erik

Reply via email to