manpagez: man pages & more
info grep
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.6 File and Directory Selection

-a
--text

Process a binary file as if it were text; this is equivalent to the ‘--binary-files=text’ option.

--binary-files=type

If the first few bytes of a file indicate that the file contains binary data, assume that the file is of type type. By default, type is ‘binary’, and grep normally outputs either a one-line message saying that a binary file matches, or no message if there is no match. If type is ‘without-match’, grep assumes that a binary file does not match; this is equivalent to the ‘-I’ option. If type is ‘text’, grep processes a binary file as if it were text; this is equivalent to the ‘-a’ option. Warning:--binary-files=text’ might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands.

-D action
--devices=action

If an input file is a device, FIFO, or socket, use action to process it. By default, action is ‘read’, which means that devices are read just as if they were ordinary files. If action is ‘skip’, devices, FIFOs, and sockets are silently skipped.

-d action
--directories=action

If an input file is a directory, use action to process it. By default, action is ‘read’, which means that directories are read just as if they were ordinary files (some operating systems and file systems disallow this, and will cause grep to print error messages for every directory or silently skip them). If action is ‘skip’, directories are silently skipped. If action is ‘recurse’, grep reads all files under each directory, recursively; this is equivalent to the ‘-r’ option.

--exclude=glob

Skip files whose base name matches glob (using wildcard matching). A file-name glob can use ‘*’, ‘?’, and ‘[’...‘]’ as wildcards, and \ to quote a wildcard or backslash character literally.

--exclude-from=file

Skip files whose base name matches any of the file-name globs read from file (using wildcard matching as described under ‘--exclude’).

--exclude-dir=dir

Exclude directories matching the pattern dir from recursive directory searches.

-I

Process a binary file as if it did not contain matching data; this is equivalent to the ‘--binary-files=without-match’ option.

--include=glob

Search only files whose base name matches glob (using wildcard matching as described under ‘--exclude’).

-r
-R
--recursive

For each directory mentioned on the command line, read and process all files in that directory, recursively. This is the same as the ‘--directories=recurse’ option.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 17, 2011 using texi2html 5.0.