in reply to What is faster?

As juerd already said: It depends.

but then there is also the possibility to bendchmark your script in order to find out what's faster on YOUR system. You will have to benchmark again if you change the system.

In general: I would go the second way and not rely on any external grep-command to exist. The problems with them are, as far as I can see:

  1. Is it in the PATH?
  2. If not, what's it's path?
  3. If it is, is it safe to assume that it is always the same grep you call? (some other earlier in the path at some later time)
  4. How does that grep evaluate it's parameters?
  5. How to escape meta characters?
  6. What are the meta characters?
  7. ...