Why Direct Invocation of egrep or fgrep is Deprecated – Grep Usage

grep

According to the manual page of grep-Programs,

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.

Why are they deprecated?

Best Answer

They have been removed from POSIX, with the following rationale:

This grep has been enhanced in an upwards-compatible way to provide the exact functionality of the historical egrep and fgrep commands as well. It was the clear intention of the standard developers to consolidate the three greps into a single command.

The old egrep and fgrep commands are likely to be supported for many years to come as implementation extensions, allowing historical applications to operate unmodified.

So egrep and fgrep are basically temporary artifacts on the way to a complete grep, which has now been available for a long time; they have served their purpose and are no longer needed, hence their deprecation.

Further evidence for this is to be found in old Unix releases: egrep and fgrep didn’t have separate manpages, they were documented in the grep manpage, which states explicitly

Ideally there should be only one grep, but we don't know a single algorithm that spans a wide enough range of space-time tradeoffs.

Related Question