CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/html_node/File-and-Directory-Selection.html =================================================================== RCS file: manual/html_node/File-and-Directory-Selection.html diff -N manual/html_node/File-and-Directory-Selection.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ manual/html_node/File-and-Directory-Selection.html 24 May 2009 18:42:58 -0000 1.1 @@ -0,0 +1,114 @@ +<html lang="en"> +<head> +<title>File and Directory Selection - GNU Grep 2.5.4</title> +<meta http-equiv="Content-Type" content="text/html"> +<meta name="description" content="GNU Grep 2.5.4"> +<meta name="generator" content="makeinfo 4.13"> +<link title="Top" rel="start" href="index.html#Top"> +<link rel="up" href="Command_002dline-Options.html#Command_002dline-Options" title="Command-line Options"> +<link rel="prev" href="Context-Line-Control.html#Context-Line-Control" title="Context Line Control"> +<link rel="next" href="Other-Options.html#Other-Options" title="Other Options"> +<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> +<!-- +This manual is for `grep', a pattern matching engine. + +Copyright (C) 1999, 2000, 2001, 2002, 2005, 2008, 2009 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included + in the section entitled ``GNU Free Documentation License''. + --> +<meta http-equiv="Content-Style-Type" content="text/css"> +<style type="text/css"><!-- + pre.display { font-family:inherit } + pre.format { font-family:inherit } + pre.smalldisplay { font-family:inherit; font-size:smaller } + pre.smallformat { font-family:inherit; font-size:smaller } + pre.smallexample { font-size:smaller } + pre.smalllisp { font-size:smaller } + span.sc { font-variant:small-caps } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } +--></style> +</head> +<body> +<div class="node"> +<a name="File-and-Directory-Selection"></a> +<p> +Next: <a rel="next" accesskey="n" href="Other-Options.html#Other-Options">Other Options</a>, +Previous: <a rel="previous" accesskey="p" href="Context-Line-Control.html#Context-Line-Control">Context Line Control</a>, +Up: <a rel="up" accesskey="u" href="Command_002dline-Options.html#Command_002dline-Options">Command-line Options</a> +<hr> +</div> + +<h4 class="subsection">2.1.6 File and Directory Selection</h4> + + <dl> +<dt>‘<samp><span class="samp">-a</span></samp>’<dt>‘<samp><span class="samp">--text</span></samp>’<dd><a name="index-g_t_002da-88"></a><a name="index-g_t_002d_002dtext-89"></a><a name="index-suppress-binary-data-90"></a><a name="index-binary-files-91"></a>Process a binary file as if it were text; +this is equivalent to the ‘<samp><span class="samp">--binary-files=text</span></samp>’ option. + + <dt>‘<samp><span class="samp">--binary-files=</span><var>type</var></samp>’<dd><a name="index-g_t_002d_002dbinary_002dfiles-92"></a><a name="index-binary-files-93"></a>If the first few bytes of a file indicate that the file contains binary data, +assume that the file is of type <var>type</var>. +By default, <var>type</var> is ‘<samp><span class="samp">binary</span></samp>’, +and <samp><span class="command">grep</span></samp> normally outputs either +a one-line message saying that a binary file matches, +or no message if there is no match. +If <var>type</var> is ‘<samp><span class="samp">without-match</span></samp>’, +<samp><span class="command">grep</span></samp> assumes that a binary file does not match; +this is equivalent to the ‘<samp><span class="samp">-I</span></samp>’ option. +If <var>type</var> is ‘<samp><span class="samp">text</span></samp>’, +<samp><span class="command">grep</span></samp> processes a binary file as if it were text; +this is equivalent to the ‘<samp><span class="samp">-a</span></samp>’ option. +<em>Warning:</em> ‘<samp><span class="samp">--binary-files=text</span></samp>’ 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. + + <br><dt>‘<samp><span class="samp">-D </span><var>action</var></samp>’<dt>‘<samp><span class="samp">--devices=</span><var>action</var></samp>’<dd><a name="index-g_t_002dD-94"></a><a name="index-g_t_002d_002ddevices-95"></a><a name="index-device-search-96"></a>If an input file is a device, FIFO, or socket, use <var>action</var> to process it. +By default, <var>action</var> is ‘<samp><span class="samp">read</span></samp>’, +which means that devices are read just as if they were ordinary files. +If <var>action</var> is ‘<samp><span class="samp">skip</span></samp>’, +devices, FIFOs, and sockets are silently skipped. + + <br><dt>‘<samp><span class="samp">-d </span><var>action</var></samp>’<dt>‘<samp><span class="samp">--directories=</span><var>action</var></samp>’<dd><a name="index-g_t_002dd-97"></a><a name="index-g_t_002d_002ddirectories-98"></a><a name="index-directory-search-99"></a>If an input file is a directory, use <var>action</var> to process it. +By default, <var>action</var> is ‘<samp><span class="samp">read</span></samp>’, +which means that directories are read just as if they were ordinary files +(some operating systems and file systems disallow this, +and will cause <samp><span class="command">grep</span></samp> +to print error messages for every directory or silently skip them). +If <var>action</var> is ‘<samp><span class="samp">skip</span></samp>’, directories are silently skipped. +If <var>action</var> is ‘<samp><span class="samp">recurse</span></samp>’, +<samp><span class="command">grep</span></samp> reads all files under each directory, recursively; +this is equivalent to the ‘<samp><span class="samp">-r</span></samp>’ option. + + <br><dt>‘<samp><span class="samp">--exclude=</span><var>glob</var></samp>’<dd><a name="index-g_t_002d_002dexclude-100"></a><a name="index-exclude-files-101"></a><a name="index-searching-directory-trees-102"></a>Skip files whose base name matches <var>glob</var> +(using wildcard matching). +A file-name glob can use +‘<samp><span class="samp">*</span></samp>’, ‘<samp><span class="samp">?</span></samp>’, and ‘<samp><span class="samp">[</span></samp>’...‘<samp><span class="samp">]</span></samp>’ as wildcards, +and <code>\</code> to quote a wildcard or backslash character literally. + + <br><dt>‘<samp><span class="samp">--exclude-from=</span><var>file</var></samp>’<dd><a name="index-g_t_002d_002dexclude_002dfrom-103"></a><a name="index-exclude-files-104"></a><a name="index-searching-directory-trees-105"></a>Skip files whose base name matches any of the file-name globs +read from <var>file</var> (using wildcard matching as described +under ‘<samp><span class="samp">--exclude</span></samp>’). + + <br><dt>‘<samp><span class="samp">--exclude-dir=</span><var>dir</var></samp>’<dd><a name="index-g_t_002d_002dexclude_002ddir-106"></a><a name="index-exclude-directories-107"></a>Exclude directories matching the pattern <var>dir</var> from recursive +directory searches. + + <br><dt>‘<samp><span class="samp">-I</span></samp>’<dd>Process a binary file as if it did not contain matching data; +this is equivalent to the ‘<samp><span class="samp">--binary-files=without-match</span></samp>’ option. + + <br><dt>‘<samp><span class="samp">--include=</span><var>glob</var></samp>’<dd><a name="index-g_t_002d_002dinclude-108"></a><a name="index-include-files-109"></a><a name="index-searching-directory-trees-110"></a>Search only files whose base name matches <var>glob</var> +(using wildcard matching as described under ‘<samp><span class="samp">--exclude</span></samp>’). + + <br><dt>‘<samp><span class="samp">-r</span></samp>’<dt>‘<samp><span class="samp">-R</span></samp>’<dt>‘<samp><span class="samp">--recursive</span></samp>’<dd><a name="index-g_t_002dr-111"></a><a name="index-g_t_002d_002drecursive-112"></a><a name="index-recursive-search-113"></a><a name="index-searching-directory-trees-114"></a>For each directory mentioned on the command line, +read and process all files in that directory, recursively. +This is the same as the ‘<samp><span class="samp">--directories=recurse</span></samp>’ option. + +</dl> + + </body></html> +
