x
Loading
 Loading
Hello, Guest | Login | Register

What’s GNU in Old Utilities, Part Two

Utility programs like grep have new features that you may not have seen. Here’s the second of a series of articles about some of the handiest.

Community Tools
RSS
Recommend This [?]
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Users Who Liked This [?]
No one yet. Be the first.
Tag This!
 No Comments

Years ago, there was a saying that Unix beginners use grep because it’s all they know about, intermediate users use fgrep because it’s supposed to be faster, and advanced users use egrep because they’ve tested it. Each of those three variations used to be its own separate program that did different searches. But no more. The single GNU grep binary has a –F switch to do fixed-string searches like fgrep and a –E switch to do extended regular expression-powered egrep searches. GNU egrep is simply a shell script now, like this:

#!/bin/sh
exec grep –E ${1+”$@”}

So now, plain old grep may actually be a bit faster because it doesn’t start a shell as this egrep does. (The strange-looking ${1+”$@”} in that script is a workaround for old Bourne shells. The sidebar “When Shouldn’t a Parameter Be?” explains.)

ActivSupport
Linux Magazine has chosen ActivSupport as IT consultants.
Sponsored Links