grep Pocket Reference
A Quick Pocket Reference for a Utility Every Unix User Needs
Publisher: O'Reilly Media
Final Release Date: January 2009
Pages: 86

grep Pocket Reference is the first guide devoted to grep, the powerful Unix content-location utility. This handy book is ideal for system administrators, security professionals, developers, and others who want to learn more about grep and take new approaches with it -- for everything from mail filtering and system log management to malware analysis. With grep Pocket Reference, you will:

  • Learn methods for filtering large files for specific content
  • Acquire information not included in the current grep documentation
  • Get several tricks for using variants such as egrep
  • Keep key information about grep right at your fingertips

Find the answers you need about grep quickly and easily. If you're familiar with this utility, grep Pocket Reference will help you refresh your basic knowledge, understand rare situations, and work more efficiently. If you're new to grep, this book is the best way to get started.

Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews


by PowerReviews
oreillygrep Pocket Reference

(based on 2 reviews)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 2 customers

Displaying reviews 1-2

Back to top

(2 of 2 customers found this review helpful)


Too many errors given the book length

By Schpliz

from Seattle, WA

About Me Developer

Verified Reviewer


  • Still Useful Reference


  • Too many errors

Best Uses

  • Intermediate
  • Novice
  • Student

Comments about oreilly grep Pocket Reference:

This pocket reference has a lot of errata, perhaps the most glaring
of which is the link to the errata page: (on pg. 4)
which does not exist. I'm very disappointed by the quality of
O'Reilly's proofreading staff (if indeed any were employed for
this product) and their apparent lack of concern for propagating
corrections. Just a few examples:

The '-l' option is listed twice, once as '--files-with-matches' (pg. 30)
and once as '--binary-files=without-match' (pg. 36). (The latter
should be '-I', on both pgs. 35 & 36.)

Forward slash ('/') and backslash ('\') are confused several times
under PCRE "Octal Searching" on pg. 46 and again for hex searches
on pg. 60.

In addition, the command given on page 60 for hex searching:
grep '[\xabaa]'
doesn't work as intended.

$ echo -e '\xab\xaa\n\xab\xaa' | grep '[\xabaa]'

gives no output. The given grep command is actually a character class
search for the characters 'x', 'a', & 'b', as shown here:

$ echo -e 'xab\nxab' | grep '[\xabaa]'

The correct command would use -P and no brackets (here in an emacs shell buffer):

$ echo -e '\xab\xaa\n\xab\xaa' | grep -P '\xab\xaa'

The "interesting aside" (last paragraph of the "Binary File Searching"
section) on pg. 61 is wrong - at least for GNU grep using PCRE:

$ echo "wrong" | grep -P '\x77\x72\x6F\x6E\x67'

The statement on pg. 14:
"Used alone it will match every line in a stream except the final
line, which is terminated by an "end of file" character instead of
an "end of line" character."
is also incorrect, as this example in a Unix shell shows:

$ echo 'abc
> def
> ghi' | grep '$'

(I haven't seen an "end of file" (EOF) "character", since ancient DOS,
which used Control-Z, and even that was optional.)

This assertion:
"For instance, [:upper:] can also be written as [A-Z] and uses ..."
(pgs. 20-21) is only partially true (i.e., for ASCII/English).

The first piping example on page 25:
cat editinfo | grep Smith | grep -v hi.txt
will work, but should probably be:
cat editinfo | grep Smith | grep -v 'hi\.txt'
to reinforce the discussion of the \ (escape) character on pg. 13.

The second (shorter) example at the bottom of page 25 doesn't work
at all. (It sits waiting for input from stdin for the first command.):
grep Smith | grep -v hi.txt

The discussion of 'fgrep -b' on pg. 42 mixes block number and byte
number. They are not the same.

"... PCRE can search from a character in hex format ..."
should be "for a character". (pg. 46)

Even a non-technical editor or proofreader should be able to catch
awkward or incorrect English like this:

"The results of this simple command: 'install.*file' the results
should output ..." (pg 15)

"When a search can be accomplished using fewer commands or with
fewer decisions having to be made, the more efficiently it will
behave." (pg. 26)

"... if you want to monitor a logfile in real-time for specified
content, she could use the following command: ..." (pg. 26)

"To use this, the \p or \P sequence is used." (pg. 46)

The Pocket Guide is still useful as a reference, but I would
like to have seen fewer errors and a real errata page.

(2 of 2 customers found this review helpful)


Good Book on the Basics of REGEX & GREP

By Roger

from North Pole, AK


  • Concise
  • Helpful examples


  • Grammar and flow
  • Needs corrections

Best Uses

  • Intermediate
  • Novice
  • Student

Comments about oreilly grep Pocket Reference:

I needed a book that would teach me REGEX and how better to use grep/fgrep, but without having to learn PERL and JAVA. (ie. Master Regular Expressions contains over half the data relevant to other languages.)

This "grep Pocket Reference" did a good job of explaining the grep options in tandem with the it's Manual Page. Although few, I thought the examples near the end were great. However, the examples seemed to be themed on personal private data searching rather then something more relevant to a computer users -- but they could easily be converted.

This EBook needs some corrections (a reprint including errata?) as it contains some grammar or run-on sentences which conflict and provide incorrect data. Also, there's a sentence in the book stating, in effect, it's OK or legal to use fgrep to search other peoples EMail. I'm no lawyer, but this doesn't sound correct. Again, those few sentences probably need a little rewording.

All in all, besides the fact it needed a good proof reading -- the book taught me what I needed to learn about grep as it's manual page lacks examples and a certain amount of clarity. (Currently, grep's manual page is written like a specification rather then something focused towards a user, omitting example usage.)

(There is a small chapter on Perl REGEX. ie. --perl-regexp)

If you need a book to learn REGEX and have a little trouble with the GREP Manual Page, or don't want to read a huge book like Mastering REGEX, get this book for learning REGEX (aka BRE/ERE).

Also noteworthy, the MOBI formated EBook version of this "grep Pocket Reference" is the first readable MOBI EBook I've been able to read so far on my Kindle DXG. This book had few TABLE TAGS (or computer technical drawings/coding). And of the presented console/terminal text presented, it was readable unlike many other MOBI technical books I've tried to read.

Displaying reviews 1-2

Back to top

Buy 2 Get 1 Free Free Shipping Guarantee
Buying Options
Immediate Access - Go Digital what's this?
Ebook:  $9.99
Formats:  DAISY, ePub, Mobi, PDF
Print & Ebook:  $14.29
Print:  $12.99

Available in Multiple Languages