fgrep,grep and egrep

Kevin J. Cummings cummings at kjchome.homeip.net
Tue Jun 8 16:54:35 UTC 2010


On 06/08/2010 12:40 PM, Kaushal Shriyan wrote:
> Hi,
> 
> can someone explain me about the usage of grep , fgrep and egrep
> with examples.
> In what contexts i should use which.

The grep man page explains it well enough:

>        In addition, two variant programs egrep and fgrep are available.  egrep is the same as grep -E.  fgrep is the same as grep -F.  Direct
>        invocation  as  either  egrep  or  fgrep  is  deprecated,  but  is  provided to allow historical applications that rely on them to run
>        unmodified.

>        -E, --extended-regexp
>               Interpret PATTERN as an extended regular expression (ERE, see below).  (-E is specified by POSIX.)
> 
>        -F, --fixed-strings
>               Interpret  PATTERN  as  a  list  of  fixed  strings, separated by newlines, any of which is to be matched.  (-F is specified by
>               POSIX.)

When in doubt, RTFM.

> Please guide/suggest
> 
> Thanks and Regards,
> 
> Kaushal

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the users mailing list