Reply to comment

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

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.