⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 13-grep.mht

📁 这是著名的源码浏览工具(不仅仅浏览
💻 MHT
📖 第 1 页 / 共 5 页
字号:
From: <由 Windows Internet Explorer 7 保存>
Subject: Grep
Date: Thu, 15 May 2008 14:48:41 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
	type="text/html";
	boundary="----=_NextPart_000_0108_01C8B69A.C44FC4C0"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198

This is a multi-part message in MIME format.

------=_NextPart_000_0108_01C8B69A.C44FC4C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://sourcenav.sourceforge.net/online-docs/userguide/grep.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" =
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML><HEAD><TITLE>Grep</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3DISO-8859-1">
<META http-equiv=3DContent-Style-Type content=3Dtext/css>
<META content=3D"MSHTML 6.00.6000.16544" name=3DGENERATOR><LINK=20
href=3D"http://sourcenav.sourceforge.net/online-docs/cygnus2.css" =
type=3Dtext/css=20
charset=3DISO-8859-1 rel=3DSTYLESHEET></HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<TABLE class=3DTABLE cellPadding=3D1 width=3D100 align=3Dcenter =
border=3D0>
  <TBODY>
  <TR>
    <TD align=3Dmiddle>
      <P class=3DGotos><A=20
      =
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/index_ug.h=
tml">Contents</A>=20
      </P></TD>
    <TD align=3Dmiddle>
      <P class=3DGotos><A=20
      =
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/retrvr.htm=
l">Previous</A></P></TD>
    <TD align=3Dmiddle>
      <P class=3DGotos><A=20
      =
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/versctrl.h=
tml">Next</A></P></TD></TR></TBODY></TABLE>
<HR align=3Dcenter>
</DIV>
<TABLE>
  <TBODY>
  <TR>
    <TD></TD></TR></TBODY></TABLE>
<H1 class=3DChapterTitle><A name=3DpgfId-998204></A><BR><A =
name=3D21607></A>Grep
<DIV><IMG=20
src=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep-1.gif"=
>=20
</DIV></H1>
<P class=3DBody><A name=3DpgfId-998211></A>The Source-Navigator <SPAN=20
class=3DBold>Grep</SPAN> <A name=3Dmarker-998209></A>tool allows you to =
search for=20
<A name=3Dmarker-998210></A>text patterns in source files throughout the =
project.=20
It is more powerful than using <KBD class=3DCode>grep</KBD> at the =
command line=20
because it:</P>
<UL>
  <LI class=3DBullet>
  <P class=3DBody><A name=3DpgfId-998213></A>allows you to search =
multiple=20
  directories. </P>
  <LI class=3DBullet>
  <P class=3DBody><A name=3DpgfId-998214></A>searches only the files in =
your=20
  project. </P>
  <LI class=3DBullet>
  <P class=3DBody><A name=3DpgfId-998215></A>can be restricted to a =
subset of the=20
  files in your project. </P>
  <LI class=3DBullet>
  <P class=3DBody><A name=3DpgfId-1001723></A>saves results of multiple =
searches, so=20
  you can review them later. </P>
  <LI class=3DBullet>
  <P class=3DBody><A name=3DpgfId-1001724></A>provides "one-click" <SPAN =

  class=3DBold>Editor</SPAN> access to the lines of code matching your =
search.=20
  </P></LI></UL>
<P class=3DBody>To search for text patterns in the name of the symbols =
in the=20
database, use the <SPAN class=3DBold>Retriever</SPAN> tool. For more =
information,=20
see <A=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/retrvr.htm=
l">Retriever</A>.=20

<H2 class=3DHeading1><A name=3DpgfId-998217></A><A =
name=3D12133></A>Using Grep</H2>
<P class=3DBody><A name=3DpgfId-998218></A>Start the <SPAN =
class=3DBold>Grep</SPAN>=20
tool from the <SPAN class=3DBold>Windows</SPAN> menu by selecting <SPAN=20
class=3DBold>New View </SPAN><EM class=3DArrow>-&gt;</EM> <SPAN=20
class=3DBold>Grep-Editor</SPAN>. This opens a <SPAN =
class=3DBold>Grep/Editor</SPAN>=20
split window (for more information on split windows, see <A class=3DXRef =

href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/usingsn.ht=
ml#23741">Adding=20
a Browser to an Existing Window</A>). </P>
<P class=3DFigureTitle><A name=3DpgfId-998222></A>The Grep/Editor =
Window</P>
<DIV><IMG=20
src=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep-2.gif"=
> </DIV>
<P class=3DBody><A name=3DpgfId-998233></A>In the <SPAN =
class=3DBold>Pattern</SPAN>=20
text box, enter a regular expression then click the <SPAN =
class=3DBold>Search=20
</SPAN>icon. For more information on regular expressions, see <A =
class=3DXRef=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep.html#=
24033">GNU=20
Regular Expressions</A>. </P>
<P class=3DBody><A name=3DpgfId-998237></A>You can use the <SPAN=20
class=3DBold>Files</SPAN> filter to limit your search; for example, =
entering <KBD=20
class=3DCode>*.c</KBD> restricts the search to only C files. For a list =
of file=20
extensions and their associated languages see <A class=3DXRef=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/usingsn.ht=
ml#40836">File=20
Types and Associated Filename Extensions</A>. <A class=3DXRef=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep.html#=
28392">Sample=20
Grep Search Results</A> shows the results of a sample <A=20
name=3Dmarker-998244></A>Grep search.</P>
<P class=3DFigureTitle><A name=3DpgfId-998253></A><A =
name=3D28392></A>Sample Grep=20
Search Results</P>
<DIV><IMG=20
src=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep-3.gif"=
> </DIV>
<P class=3DBody><A name=3DpgfId-998258></A>Clicking on an item in the =
<SPAN=20
class=3DBold>Grep</SPAN> window displays the appropriate file in the =
<SPAN=20
class=3DBold>Editor</SPAN> <A name=3Dmarker-998257></A>, with the cursor =
positioned=20
at the selected line. </P>
<P class=3DBody><A name=3DpgfId-998259></A>To step through the <SPAN=20
class=3DBold>Grep</SPAN> results, click the left or right black arrow =
keys in the=20
toolbar. To filter your <SPAN class=3DBold>Grep</SPAN> results, use the =
<SPAN=20
class=3DBold>Format</SPAN> combo-box to select an option.</P>
<H2 class=3DHeading1><A name=3DpgfId-998262></A><A name=3D24033></A><A=20
name=3Dmarker-998261></A>GNU Regular Expressions</H2>
<P class=3DBody><A name=3DpgfId-998266></A>A GNU regular expression<A =
class=3Dfootnote=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep.html#=
pgfId-998265"><SUP>1</SUP></A>=20
<A name=3Dfn1></A>is a pattern that describes a set of strings. Regular=20
expressions are constructed like arithmetic expressions: various =
operators=20
combine smaller expressions to form larger expressions. </P>
<H3 class=3DHeading2><A name=3DpgfId-998267></A>Ordinary Characters</H3>
<P class=3DBody><A name=3DpgfId-998268></A>An ordinary character is a =
simple regular=20
expression that matches a single character and nothing else. For =
example, <SPAN=20
class=3DBold>f</SPAN> matches <SPAN class=3DBold>f</SPAN> and no other =
string. You=20
can concatenate regular expressions together. For example, <SPAN=20
class=3DBold>foo</SPAN> matches <SPAN class=3DBold>foo</SPAN> and no =
other=20
string.</P>
<H3 class=3DHeading2><A name=3DpgfId-998269></A>Special Characters</H3>
<P class=3DBody><A name=3DpgfId-998270></A>You can combine regular =
expressions with=20
regular expression operators, or <EM =
class=3DEmphasis>metacharacters</EM>, to=20
increase the versatility of regular expressions. Traditional expression=20
characters are enclosed by brackets <SPAN class=3DBold>[</SPAN> and =
<SPAN=20
class=3DBold>]</SPAN>. </P>
<P class=3DBody><A name=3DpgfId-998271></A>For example, <SPAN=20
class=3DBold>[Aa]pple</SPAN> matches either <SPAN =
class=3DBold>Apple</SPAN> or <SPAN=20
class=3DBold>apple</SPAN>. A range of characters is indicated by a dash =
<SPAN=20
class=3DBold>-</SPAN>. <SPAN class=3DBold>[a-z]</SPAN> matches any =
lowercase letter=20
and <SPAN class=3DBold>[0-9]</SPAN> matches any digit string between 0 =
and 9. You=20
can string groups together, so that <SPAN =
class=3DBold>[a-zA-Z0-9]</SPAN> matches=20
any single alphanumeric character.</P>
<P class=3DBody><A name=3DpgfId-998273></A>To represent the <SPAN=20
class=3DBold>-</SPAN> dash itself, it must be the last character, =
directly=20
succeeded by the <SPAN class=3DBold>]</SPAN>. To represent <SPAN=20
class=3DBold>]</SPAN> bracket, it must be the first character after the =
<SPAN=20
class=3DBold>[</SPAN> or the <SPAN class=3DBold>[^</SPAN>.</P>
<P class=3DBody><A name=3DpgfId-998342></A><A class=3DXRef=20
href=3D"http://sourcenav.sourceforge.net/online-docs/userguide/grep.html#=
16603">Special=20
Characters</A> lists special characters and examples of how to use =
them.</P>
<TABLE border=3D1>
  <CAPTION>
  <P class=3DTableTitle><A name=3DpgfId-998283></A><A =
name=3D16603></A>Special=20
  Characters </P></CAPTION>
  <TBODY>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellHeading><A name=3DpgfId-998289></A>Symbol</P></TD>
    <TD>
      <P class=3DCellHeading><A =
name=3DpgfId-998291></A>Definition</P></TD>
    <TD>
      <P class=3DCellHeading><A =
name=3DpgfId-998293></A>Example</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998295></A><SPAN =
class=3DBold>.</SPAN>=20
      (period) </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998297></A>matches any single =
character=20
      except a new line</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998299></A><SPAN=20
      class=3DBold>a.b<BR></SPAN>matches any three-character string =
beginning with=20
      <SPAN class=3DBold>a</SPAN> and ending with <SPAN =
class=3DBold>b</SPAN> (such=20
      as <SPAN class=3DBold>acb</SPAN>, <SPAN class=3DBold>a6b</SPAN>, =
<SPAN=20
      class=3DBold>a#b</SPAN>)</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998301></A><SPAN =
class=3DBold>[ ... ]</SPAN>=20
      </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998303></A>matches characters =
between the=20
      brackets.</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998305></A><SPAN=20
      class=3DBold>[af]<BR></SPAN>matches either one <SPAN =
class=3DBold>a</SPAN> or=20
      one <SPAN class=3DBold>f<BR>[af]*<BR></SPAN>matches any string =
composed of=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -