What's the difference between egrep
and grep
?
I've been search for a while online and can't find anything concise.
Are they the same except that egrep
has some extended regexp features? Thanks
What's the difference between egrep
and grep
?
I've been search for a while online and can't find anything concise.
Are they the same except that egrep
has some extended regexp features? Thanks
On my RHEL 8 system:
$ ls -la /usr/bin/egrep
-rwxr-xr-x. 1 root root 28 Aug 12 2018 /usr/bin/egrep
$ file /usr/bin/egrep
/usr/bin/egrep: POSIX shell script, ASCII text executable
$ cat /usr/bin/egrep
#!/bin/sh
exec grep -E "$@"
So, yes - egrep
is simply a wrapper around grep
that turns on the extended regexp features.
Extract from man page on Debian Gnu/Linux
... the variant programs egrep, fgrep and rgrep are the same
as grep -E, grep -F, and grep -r, respectively. These variants are
deprecated, but are provided for backward compatibility.
grep
) and extended regular expressions (ERE,grep -E
/egrep
) – ilkkachu Aug 10 '21 at 21:01