Egrep
Posted in: Helpful command reference | May 19th, 2008
While many people use the grep command through a pipe | there are more efficient ways of using it. I have nearly killed a server on many occasions by running cat filename |grep some-term while the command tries to list a huge file. Instead simply use egrep which is more efficient in terms of speed and system resources.
Simple form:
egrep pattern file
Translation:
egrep what-I-want /var/log/messages
Where what-I-want is the term you are looking for within the messages log file. There are also a lot of advanced searched you can do if you need to look in multiple files or ignore some things. Below is the readout of the manpage via egrep –help showing many of the options.
(more…)