In this case discussed: find (GNU findutils) 4.5.11 grep (GNU grep) 2.20
Let's say I have a directory that contains a bunch of files. I want to find the files named jtobdops02.key and jtobdops.02.cer.
find . -regextype posix-extended -regex ".*jtobdops02\.(key|cer)"
find . -type f | grep -E '.*jtobdops02.*(key|cer)'
Also gives as expected:
find . -type f | grep -E '*jtobdops02.*(key|cer)'
The man for find states:
This is a match on the whole path, not a search.
The man for grep states:
grep, egrep, fgrep - print lines matching a pattern
If they both do matching, not search, why does the latter grep still work? Also in the latter case there is no preceding sub expression for grep to match, so what does the
* match in this case? The colored(bold) output shows no difference, so I assume it does nothing. Shouldn't it give error in this case?
Which one of those is idiosyncrasy and which one of those is a general practice across other tools and languages?