1825162 Members
3046 Online
109679 Solutions
New Discussion юеВ

egrep

 
Basel Naamna
Occasional Contributor

egrep

is egrep a standard unix/linux command that is provided with any distribution/release?
or it's not included in all the unix's
8 REPLIES 8
Florian Heigl (new acc)
Honored Contributor

Re: egrep

I haven't seen all unix's yet, but I'd say 'yes, every unix has it'.

If reality proves me wrong You can try to use gnu grep (part of fileutils, iirc).
yesterday I stood at the edge. Today I'm one step ahead.
Pat Lieberg
Valued Contributor

Re: egrep

It's been part of every flavor I have worked on (Solaris, AIX, HP-UX, Linux).

Mauro Gatti
Valued Contributor

Re: egrep

Grep, egrep and fgrep are the same file! :-)

1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/egrep
1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/fgrep
1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/grep

So, I think, they are togheter in all HPUX releases.

RGDS

Mauro
Ubi maior, minor cessat!
MarkSyder
Honored Contributor

Re: egrep

egrep (extended grep) is considered obsolete and has been superseded by grep -E

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Vibhor Kumar Agarwal
Esteemed Contributor

Re: egrep

No I don't think they are the same files.

But they come with every installation.
Why do you want egrep.

Practically speaking grep is more powerful than egrep.

Just use -E with grep.
Vibhor Kumar Agarwal
Mauro Gatti
Valued Contributor

Re: egrep

vibhor_agarwalin for me "same inode= same file" (in same filesystem)
so:

# ls -li /usr/bin/*grep
1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/egrep
1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/fgrep
1215 -r-xr-xr-x 3 bin bin 24576 Nov 14 2000 /usr/bin/grep
8389 -r-xr-xr-x 1 bin bin 24576 Nov 14 2000 /usr/bin/nisgrep

means the first three files are statically linked toghether and are the same file with inode 1215

RGDS
Ubi maior, minor cessat!
Mauro Gatti
Valued Contributor

Re: egrep

I think is the same for ls command :

# find /usr/bin -inum 38 -exec ls -li {} \;
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/l
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/lc
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/ll
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/ls
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/lsf
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/lsr
38 -r-xr-xr-x 7 bin bin 28672 May 5 2003 /usr/bin/lsx
Ubi maior, minor cessat!
Kent Ostby
Honored Contributor

Re: egrep

That's actually fairly common as you note above.

Inside the code, it knows which of three "greps" its being referenced as so it behaves according to what that "grep" does.

Same for the ll and others.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"