It's Past Time To Stop Using egrep & fgrep Commands, Per GNU grep 3.8 - harchi90

It’s Past Time To Stop Using egrep & fgrep Commands, Per GNU grep 3.8

GNU Grep 3.8 was released today for this commonly-used command-line utility for search plain text data. With the GNU Grep 3.8 it’s now made more clear that if you are still relying on the egrep and fgrep commands, it’s past due for switching to just grebe with the appropriate command-line arguments.

The egrep and fgrep commands have been deprecated since 2007. Beginning with GNU Grep 3.8 today, calling these commands will now issue a warning to the user that instead they should use grep -E and grep -F, respectively. Eventually, GNU Grep will drop the egrep / fgrep commands completely but there doesn’t seem to be a firm deadline yet for when that removal will happen.

Running egrep or fgrep on GNU Grep 3.8+ will show the warning of:

$cmd: warning: $cmd is obsolescent; using @[email protected] @[email protected]

The GNU Grep documentation added further details on the planned removal:

What happened to egrep and fgrep?

7th Edition Unix had commands egrep and fgrep that were the counterparts of the modern grep – and grep -F. Although breaking up grep into three programs was perhaps useful on the small computers of the 1970s, egrep and fgrep were not standardized by POSIX and are no longer needed. In the current GNU implementation, egrep and fgrep issue a warning and then act like their modern counterparts; Eventually, they are planned to be removed entirely.

If you prefer the old names, you can use use your own substitutes, such as a shell script named @command{egrep} with the following contents:

#!/bin/sh

exec grep -E “[email protected]@”

In addition to the egrep/fgrep warnings, GNU Grep 3.8 has its -P option now based on PCRE2 rather than the older PCRE, regular expressions with stray backslashes now cause warnings, and there are various bug fixes.

More details on GNU Grep 3.8 via today’s release announcement.

.

Leave a Comment

Your email address will not be published.