Do a man on grep.  Grep is a VERY useful tool in *nix.  It's great for use in scripts, 
as well as just
basic use.  For example, say you're looking for an error message, or something else in 
a log file, and
you're too lazy to just read through the whole file, use a command like this.

[timh@yoda timh]$ cat /var/log/messages | grep shutdown
May 29 14:17:58 yoda shutdown: reboot by timh:
May 29 14:58:28 yoda shutdown: reboot by timh:
May 29 16:22:44 yoda shutdown: reboot by root:
May 29 16:27:44 yoda shutdown: reboot by root:

As you can see, all I did was cat the file, then sent it through grep looking for the 
word shutdown.  You
can also use grep without the use of another program like cat.

[timh@yoda timh]$ grep shutdown /var/log/messages
May 29 14:17:58 yoda shutdown: reboot by timh:
May 29 14:58:28 yoda shutdown: reboot by timh:
May 29 16:22:44 yoda shutdown: reboot by root:
May 29 16:27:44 yoda shutdown: reboot by root:

Gives you the same output, but just gets it differently.  Some people like just piping 
(|) things through
grep, which I used to be one of those people.  But now I've started to use more and 
more of grep and
egrep as I've started to do shell scripting and expect scripting.  The grep -se isn't 
something you HAVE
to use, just something the other user just likes to use.  By looking at the man page, 
you can find out
what you would like to do with grep.
tdh


T. Holmes
UNIXTECHS.org
[EMAIL PROTECTED]
-----------------
"Real Men Us Vi!"
 
| Hi there,
| 
| how can a search for a specific text string in all files inside a
| directory/directory tree?
| 
| Thanks
| 
| Phil.
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.255 / Virus Database: 128 - Release Date: 17-May-01
| 
| 
  ------------------------------------------------------------------ 

Reply via email to