1

a small question regarding grep.

I'm doing :

find . -type d

And I have three directories :

./backup-2013-11-27
./backup-2013-11-26
./backup-2013-11-28

If I only want to retrieve the one from 11/26, I do :

find . -type d | grep "2013.*11.*26"

and it works.

However, I can't understand why :

find . -type d | grep "2013*11*26"

doesn't work ...
Indeed, I'm not using regexp here, I'm using pattern, so * should be used as wild card, or not?

1
2

grep uses a different regular expression matching than the korn shell.

That is why it is necessary for grep to include the .* (match any character 0 or more times). In ksh (and in bash) you use just * for that pattern.

The grep way is often called regex pattern and ksh wildcard pattern.

Not the answer you're looking for? Browse other questions tagged or ask your own question.