grep & egrep

grep and egrep (extended grep) are fast useful utilities.

System V and GNU grep are different, but 90% the same. The one thing I notice lacking in SystemV is the -R flag that recursively digs down to find what I am looking for...

Find the word "style" in files in a directory

user@example:% grep style *

Find the work "style" recursively in a directory - won't work on Solaris.. yet..

user@example:% grep -R style *

List files except that contain "access"

user@example:% ls | grep -v access

List files except that contain "access -or- error"

user@example:% ls | egrep -v 'access|error'

List files except that contain start with "access" - use -e then a regex

user@example:% ls | egrep -e  '^access'

Grep a file for the word "access"

user@example:% grep access /var/log/http/error.log