The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<html><head><title>tcgrep</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.01,
  using Pod::Simple::PullParser v2.02,
  under Perl v5.008002 at Thu Aug  5 13:56:33 2004 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p><b>tcgrep</b> - search for regular expressions and print</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<p><b>tcgrep</b> [ <b>-[incCwsxvhlF1HurtpaqT]</b> ] [ <b>-e</b> <i>pattern</i> ] [ <b>-f</b> <i>pattern-file</i> ] [ <b>-P</b> <i>sep</i> ] [ <i>pattern</i> ] [ <i>files</i> ...
]</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p><b>tcgrep</b> searches for lines (or,
optionally,
paragraphs) in files that satisfy the criteria specified by the user-supplied patterns.
Because <b>tcgrep</b> is a Perl program,
the user has full access to Perl&#39;s rich regular expression engine.
See <a href="http://search.cpan.org/perldoc?perlre" class="podlinkpod"
>perlre</a>.</p>

<p>The first argument after the options (assuming the user did not specify the <b>-e</b> option or the <b>-f</b> option) is taken as <i>pattern</i>.
If the user does not supply a list of file or directory names to search,
<b>tcgrep</b> will attempt to search its standard input.</p>

<p>With no arguments,
<b>tcgrep</b> will output its option list and exit.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="OPTIONS"
>OPTIONS</a></h1>

<p><b>tcgrep</b> accepts these options:</p>

<dl>
<dt><a name="-1"
><b>-1</b></a></dt><p class="pad"></p>

<dd>Allow at most one match per file.</dd><p class="pad"></p>

<dt><a name="-a"
><b>-a</b></a></dt><p class="pad"></p>

<dd>Search all files.
The default is to only search plain text files and compressed files.</dd><p class="pad"></p>

<dt><a name="-C"
><b>-C</b></a></dt><p class="pad"></p>

<dd>Output the count of the matching lines or paragraphs.
This is similar to the <b>-c</b> option (in fact,
it implies the <b>-c</b> option),
except more than one match is possible in each line or paragraph.</dd><p class="pad"></p>

<dt><a name="-c"
><b>-c</b></a></dt><p class="pad"></p>

<dd>Output the count of the matching lines or paragraphs.</dd><p class="pad"></p>

<dt><a name="-e_pattern"
><b>-e</b> <i>pattern</i></a></dt><p class="pad"></p>

<dd>Treat <i>pattern</i> as a pattern.
This option is most useful when <i>pattern</i> starts with a <code lang='und' xml:lang='und'>-</code> and the user wants to avoid confusing the option parser.</dd><p class="pad"></p>

<dd>The <b>-f</b> option supercedes the <b>-e</b> option.</dd><p class="pad"></p>

<dt><a name="-F"
><b>-F</b></a></dt><p class="pad"></p>

<dd><b>fgrep</b> mode.
Disable regular expressions and perform Boyer-Moore searches.
(Whether it lives up to the &#39;f&#39; in <b>fgrep</b> is another issue).</dd><p class="pad"></p>

<dt><a name="-f_pattern-file"
><b>-f</b> <i>pattern-file</i></a></dt><p class="pad"></p>

<dd>Treat <i>pattern-file</i> as a newline-separated list of patterns to use as search criteria.</dd><p class="pad"></p>

<dd>the <b>-f</b> option supercedes the <b>-e</b> option.</dd><p class="pad"></p>

<dt><a name="-H"
><b>-H</b></a></dt><p class="pad"></p>

<dd>Highlight matches.
This option causes <b>tcgrep</b> to attempt to use your terminal&#39;s stand-out (emboldening) functionality to highlight those portions of each matching line or paragraph that actually triggered the match.
This feature is very similar to the way the less(1) pager highlights matches.
See also <b>-u</b>.</dd><p class="pad"></p>

<dt><a name="-h"
><b>-h</b></a></dt><p class="pad"></p>

<dd>Hide filenames.
Only print matching lines or paragraphs.</dd><p class="pad"></p>

<dt><a name="-i"
><b>-i</b></a></dt><p class="pad"></p>

<dd>Ignore case while matching.
This means,
for example,
that the pattern <code lang='und' xml:lang='und'>unix</code> would match <code lang='und' xml:lang='und'>unix</code> as well as <code lang='und' xml:lang='und'>UniX</code> (plus the other fourteen possible capitalizations).
This corresponds to the <code lang='und' xml:lang='und'>/i</code> Perl regular expression switch.
See <a href="http://search.cpan.org/perldoc?perlre" class="podlinkpod"
>perlre</a>.</dd><p class="pad"></p>

<dt><a name="-l"
><b>-l</b></a></dt><p class="pad"></p>

<dd>List files containing matches.
This option tells <b>tcgrep</b> not to print any matches but only the names of the files containing matches.
This option implies the <b>-1</b> option.</dd><p class="pad"></p>

<dt><a name="-n"
><b>-n</b></a></dt><p class="pad"></p>

<dd>Number lines or paragraphs.
Before outputting a given match,
<b>tcgrep</b> will first output its line or paragraph number corresponding to the value of the Perl magic scalar $.
(whose documentation is in <a href="http://search.cpan.org/perldoc?perlvar" class="podlinkpod"
>perlvar</a>).</dd><p class="pad"></p>

<dt><a name="-P_sep"
><b>-P</b> <i>sep</i></a></dt><p class="pad"></p>

<dd>Put <b>tcgrep</b> in paragraph mode,
and use <i>sep</i> as the paragraph separator.
This is implemented by assigning <i>sep</i> to Perl&#39;s magic $/ scalar.
See <a href="http://search.cpan.org/perldoc?perlvar" class="podlinkpod"
>perlvar</a>.</dd><p class="pad"></p>

<dt><a name="-p"
><b>-p</b></a></dt><p class="pad"></p>

<dd>Paragraph mode.
This causes <b>tcgrep</b> to set Perl&#39;s magic $/ to <code lang='und' xml:lang='und'>&#39;&#39;</code>.
(Note that the default is to process files in line mode.) See <a href="http://search.cpan.org/perldoc?perlvar" class="podlinkpod"
>perlvar</a>.</dd><p class="pad"></p>

<dt><a name="-q"
><b>-q</b></a></dt><p class="pad"></p>

<dd>Quiet mode.
Suppress diagnostic messages to the standard error.
See <b>-s</b>.</dd><p class="pad"></p>

<dt><a name="-r"
><b>-r</b></a></dt><p class="pad"></p>

<dd>Recursively scan directories.
This option causes <b>tcgrep</b> to descend directories in a left-first,
depth-first manner and search for matches in the files of each directory it encounters.
The presence of <b>-r</b> implies a file argument of <em lang='und' xml:lang='und'>.</em>,
the current directory,
if the user does not provide filenames on the command line.
See <a href="#EXAMPLES" class="podlinkpod"
>&#34;EXAMPLES&#34;</a>.</dd><p class="pad"></p>

<dt><a name="-s"
><b>-s</b></a></dt><p class="pad"></p>

<dd>Silent mode.
Do not write to the standard output.
This option would be useful from a shell script,
for example,
if you are only interested in whether or not there exists a match for a pattern.
See also <b>-q</b>.</dd><p class="pad"></p>

<dt><a name="-T"
><b>-T</b></a></dt><p class="pad"></p>

<dd>Trace files as processed.
This causes <b>tcgrep</b> to send diagnostic messages to the standard error when skipping symbolic links to directories,
when skipping directories because the user did not give the <b>-r</b> switch,
when skipping non-plain files (see <a href="http://search.cpan.org/perldoc?perlfunc#-f" class="podlinkpod"
>&#34;-f&#34; in perlfunc</a>),
when skipping non-text files (see <a href="http://search.cpan.org/perldoc?perlfunc#-T" class="podlinkpod"
>&#34;-T&#34; in perlfunc</a>),
and when opening a file for searching</dd><p class="pad"></p>

<dt><a name="-t"
><b>-t</b></a></dt><p class="pad"></p>

<dd>Process directories in <code lang='und' xml:lang='und'>`ls -t`</code> order.
Search the files in each directory starting with the most recently modified and ending with the least recently modified.</dd><p class="pad"></p>

<dt><a name="-u"
><b>-u</b></a></dt><p class="pad"></p>

<dd>Underline matches.
This option causes <b>tcgrep</b> to attempt to use your terminal&#39;s underline functionality to underline those portions of each matching line or paragraph that actually triggered the match.
See also <b>-H</b>.</dd><p class="pad"></p>

<dt><a name="-v"
><b>-v</b></a></dt><p class="pad"></p>

<dd>Invert the sense of the match,
i.e.
print those lines or paragraphs that do <b>not</b> match.
When using this option in conjunction with <b>-f</b>,
keep in mind that the entire set of patterns are grouped together in one pattern for the purposes of negation.
See <a href="#EXAMPLES" class="podlinkpod"
>&#34;EXAMPLES&#34;</a>.</dd><p class="pad"></p>

<dt><a name="-w"
><b>-w</b></a></dt><p class="pad"></p>

<dd>Matches must start and end at word boundaries.
This is currently implemented by surrounding each pattern with a pair of <code lang='und' xml:lang='und'>\b</code>,
the Perl regular expression word boundary metasequence.
See <a href="http://search.cpan.org/perldoc?perlre" class="podlinkpod"
>perlre</a> for the precise definition of <code lang='und' xml:lang='und'>\b</code>.</dd><p class="pad"></p>

<dt><a name="-x"
><b>-x</b></a></dt><p class="pad"></p>

<dd>Exact matches only.
The pattern must match the entire line or paragraph.</dd><p class="pad"></p>
</dl>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="ENVIRONMENT"
>ENVIRONMENT</a></h1>

<p>The user&#39;s TCGREP environment variable is taken as the default set of options to <b>tcgrep</b>.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="EXAMPLES"
>EXAMPLES</a></h1>

<p>Search all files under <em lang='und' xml:lang='und'>/etc/init.d</em> for a particular pattern:</p>

<pre lang='und' xml:lang='und'>    % tcgrep -r tcgrep /etc/init.d</pre>

<p>Use of <b>-v</b> and <b>-f</b> options in conjunction with one another:</p>

<pre lang='und' xml:lang='und'>    % cat fruits
    pomme
    banane
    poire
    % cat pats
    pomme
    poire
    % tcgrep -vf pats fruits
    banane</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="TODO"
>TODO</a></h1>

<ul>
<li>Add more cool examples. :-)</li><p class="pad"></p>

<li>Perhaps allow the user to provide an exclusion pattern for skipping over files whose names match the pattern.</li><p class="pad"></p>
</ul>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="REVISION_HISTORY"
>REVISION HISTORY</a></h1>

<pre lang='und' xml:lang='und'>    tcgrep: tom christiansen&#39;s rewrite of grep
    v1.0: Thu Sep 30 16:24:43 MDT 1993
    v1.1: Fri Oct  1 08:33:43 MDT 1993

    Revision by Greg Bacon &#60;gbacon@cs.uah.edu&#62;
    Fixed up highlighting for those of us trapped in terminfo
    implemented -f
    v1.2: Fri Jul 26 13:37:02 CDT 1996

    Revision by Greg Bacon &#60;gbacon@cs.uah.edu&#62;
    Avoid super-inefficient matching (almost twice as fast! :-)
    v1.3: Sat Aug 30 14:21:47 CDT 1997

    Revision by Paul Grassie &#60;grassie@worldnet.att.net&#62;
    Removed vestiges of Perl4, made strict
    v1.4: Mon May 18 16:17:48 EDT 1998

    Revision by Greg Bacon &#60;gbacon@cs.uah.edu&#62;
    Add fgrep functionality for PPT
    v1.5: Mon Mar  8 12:05:29 CST 1999

    Revision by Bill Benedetto &#60;bbenedetto@goodyear.com&#62;
    Added CLOSE after each file is done to reset counters
    v1.6: Sat Mar 20 23:05:35 1999

    Revision by Paul Johnson &#60;paul@pjcj.net&#62;
    Add support for bzip2 and zip files
    File names are printed by default when using -r and supplying no directory
    v1.7: Thu May 27 00:25:30 BST 1999</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p><b>tcgrep</b> was written by Tom Christiansen with updates by Greg Bacon and Paul Grassie.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_and_LICENSE"
>COPYRIGHT and LICENSE</a></h1>

<p>Copyright (c) 1993-1999. Tom Christiansen.</p>

<p>This program is free and open software. You may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.</p>

<!-- end doc -->

</body></html>