Time to stop using the egrep and fgrep commands, as per GNU grep 3.8

GNU -

GNU Grep 3.8 was released today for this commonly used command line tool for searching plain text data. With GNU Grep 3.8 it is now clear that if you still rely on egrep And the fgrep From the commands, it is time to switch to only grep With appropriate command line arguments.

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

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

$cmd: Warning: $cmd is old; Use @[email protected] @[email protected]

The GNU Grep documentation added more details about the planned removal:

What happened to egrep and fgrep?

Unix version 7 had the egrep and fgrep commands that were analogous to grep and modern grep -F. Although dividing grep into three programs may have been useful on small computers in the 1970s, egrep and fgrep are not standardized by POSIX and are no longer needed. In the current GNU implementation, egrep and fgrep issue a warning and then behave like their modern counterparts; In the end, it is planned to completely remove it.

If you prefer older names, you can use your own alternatives, like a script named command {egrep} with the following contents:

#! / bin / u

exec grep -E “[email protected]@ “

In addition to the egrep/fgrep warnings, GNU Grep 3.8 has its own -P option now that is based on PCRE2 instead of the older PCRE, stray backslashes regular expressions now cause warnings, and there are several bug fixes.

See also  Do you have an old iPad around? You may be able to run it on Linux soon

More details on GNU Grep 3.8 via today release announcement.

Leave a Reply

Your email address will not be published. Required fields are marked *