[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Why grep still exists?



On Tue, May 27, 2003 at 07:39:51AM +0800, jqdkf@zju.edu.cn wrote:

> I'm just wondering why grep still exists in every distribution of UNIX
> or UNIX like system. As egrep can support a full featured regular
> expression, it is much more powerful than grep. Is it only for
> backport support?

   $ which egrep
   /bin/egrep

   $ ls -l /bin/egrep 
   -rwxr-xr-x    1 root     root           33 Apr 21 10:02 /bin/egrep

   $ file /bin/egrep
   /bin/egrep: Bourne shell script text executable

   $ cat /bin/egrep 
   #!/bin/sh
   exec grep -E ${1+"$@"}

   $ dpkg -S /bin/egrep
   grep: /bin/egrep

Looks to me like egrep is just a wrapper script to grep with specific
function calls.  So, in answer to your question would be something along
the lines of "because grep provides the egrep functionality".

Additionally, "full featured" regular expressions are beyond most
people.  For many the features provided by a normal grep call are all
they need.  Then theres the ever present matter of choice.

-- 
Jamin W. Collins



Reply to: