,  Node: File and Directory Selection,  Next: Other Options,  Prev: Context Line Control,  Up: Command-line Options

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