亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? _chapter 3.htm

?? linux、unix初學者的必讀書籍 詳細講述了shell編程方法與技巧
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Chapter 3</title>
<link rel="stylesheet" type="text/css" href="docsafari.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body><table width="100%" border="1" bgcolor="#EBEBFF"><tr><td width="5%" align="left" valign="middle"><a href="_chapter 2.htm"><img src="Larrow.gif" width="17" height="19" border="0"></a></td><td align="center" valign="middle"><a class="docLink" href="Front matter.htm">CONTENTS</a></td><td width="5%" align="right" valign="middle"><a href="_chapter 4.htm"><img src="Rarrow.gif" width="17" height="19" border="0"></a></td></tr></table>


<h2 class="docChapterTitle">Chapter 3. The grep Family</h2><ul><li>&nbsp;<a class="docLink" href="#ch03lev1sec1">3.1 The <span class="docEmphasis">grep</span> Command</a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec2">3.2 <span class="docEmphasis">grep</span> Examples with Regular Expressions</a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec3">3.3 <span class="docEmphasis">grep</span> with Pipes</a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec4">3.4 <span class="docEmphasis">grep</span> with Options</a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec5">3.5 <span class="docEmphasis">egrep</span> (Extended <span class="docEmphasis">grep</span>)</a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec6">3.6 Fixed <span class="docEmphasis">grep</span> or Fast <span class="docEmphasis">grep</span></a></li>
<li>&nbsp;<a class="docLink" href="#ch03lev1sec7">UNIX TOOLS LAB EXERCISE</a></li>
</ul>
<p class="docText">
<img alt="graphics/ch03.gif" src="ch03.gif" border="0" width="500" height="411"></p>
<p class="docText">The <span class="docEmphasis">grep</span> family consists of 
the commands <span class="docEmphasis">grep, egrep,</span> and
<span class="docEmphasis">fgrep.</span> The <span class="docEmphasis">grep</span> 
command globally searches for regular expressions in files and prints all lines 
that contain the expression. The <span class="docEmphasis">egrep</span> and
<span class="docEmphasis">fgrep</span> commands are simply variants of
<span class="docEmphasis">grep.</span> The <span class="docEmphasis">egrep</span> 
command is an extended <span class="docEmphasis">grep,</span> supporting more 
regular expression metacharacters. The <span class="docEmphasis">fgrep</span> 
command, called <span class="docEmphasis">fixed grep,</span> and sometimes
<span class="docEmphasis">fast grep,</span> treats all characters as literals; 
that is, regular expression metacharacters aren't special梩hey match themselves. 
The Free Software Foundation provides a free version of
<span class="docEmphasis">grep,</span> called GNU <span class="docEmphasis">grep.</span> 
These versions of <span class="docEmphasis">grep</span> are the ones used on 
Linux systems, and can be found in <span class="docEmphasis">/usr/xpg4/bin</span> 
on Sun's Solaris OS. The GNU version of <span class="docEmphasis">grep</span> 
has extended the basic regular expression metacharacter set, added POSIX 
compliancy, and included a number of new command line options. They also provide 
a recursive <span class="docEmphasis">grep</span> called
<span class="docEmphasis">rgrep</span> for descending entire directory trees.</p>
<h3 class="docSection1Title" id="ch03lev1sec1">3.1 The <span class="docEmphasis">grep</span> 
Command</h3>
<h4 class="docSection2Title" id="ch03lev2sec1">3.1.1 The Meaning of <span class="docEmphasis">grep</span></h4>
<p class="docText">The name <span class="docEmphasis">grep</span> can be traced 
back to the <span class="docEmphasis">ex</span> editor. If you invoked that 
editor and wanted to search for a string, you would type at the
<span class="docEmphasis">ex</span> prompt:</p>
<pre>: /pattern/p
</pre>
<p class="docText">The first line containing the string
<span class="docEmphasis">pattern</span> would be printed as &quot;<span class="docEmphasis">p</span>&quot; 
by the <span class="docEmphasis">print</span> command. If you wanted all the 
lines that contained <span class="docEmphasis">pattern</span> to be printed, you 
would type:</p>
<pre>: g/pattern/p
</pre>
<p class="docText">When <span class="docEmphasis">g</span> precedes
<span class="docEmphasis">pattern,</span> it means &quot;all lines in the file,&quot; or 
&quot;perform a global substitution.&quot;</p>
<p class="docText">Because the search pattern is called a
<span class="docEmphasis">regular expression,</span> we can substitute
<span class="docEmphasis">RE</span> for <span class="docEmphasis">pattern</span> 
and the command reads:</p>
<pre>: g/RE/p
</pre>
<p class="docText">And there you have it: the meaning of
<span class="docEmphasis">grep</span> and the origin of its name. It means &quot;<span class="docEmphasis">g</span>lobally 
search for the <span class="docEmphasis">r</span>egular
<span class="docEmphasis">e</span>xpression (<span class="docEmphasis">RE</span>) 
and <span class="docEmphasis">p</span>rint out the line.&quot; The nice part of using
<span class="docEmphasis">grep</span> is that you do --not have to invoke an 
editor to perform a search, and you do not need to enclose the regular 
expression in forward slashes. It is much faster than using
<span class="docEmphasis">ex</span> or <span class="docEmphasis">vi.</span></p>
<h4 class="docSection2Title" id="ch03lev2sec2">3.1.2 How <span class="docEmphasis">grep</span> 
Works</h4>
<p class="docText">The <span class="docEmphasis">grep</span> command searches 
for a pattern of characters in a file or multiple files. If the pattern contains 
whitespace, it must be quoted. The pattern is either a quoted string or a single 
word<span id="ENB3-1"><a class="docLink" href="#EN3-1"><sup>[1]</sup></a></span>, 
and all other words following it are treated as filenames.
<span class="docEmphasis">Grep</span> sends its output to the screen and does 
not change or affect the input file in any way.</p>
<div align="center">
  <center>
<table cellSpacing="0" width="90%" border="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="5">
  <tr>
    <td>
    <h2 class="docSidebarTitle">FORMAT</h2>
    <pre>grep word filename filename
</pre>
    </td>
  </tr>
</table>
  </center>
</div>
<h5 id="ch03list01" class="docExampleTitle">Example 3.1 </h5>
<pre><span class="docEmphStrong">grep Tom /etc/passwd</span>
</pre>
<div align="center">
  <center>
<table cellSpacing="0" width="90%" border="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="5">
  <tr>
    <td>
    <h2 class="docSidebarTitle">EXPLANATION</h2>
    <p class="docText"><span class="docEmphasis">Grep</span> will search for the 
    pattern <span class="docEmphasis">Tom</span> in a file called
    <span class="docEmphasis">/etc/passwd.</span> If successful, the line from 
    the file will appear on the screen; if the pattern is not found, there will 
    be no output at all; and if the file is not a legitimate file, an error will 
    be sent to the screen. If the pattern is found, <span class="docEmphasis">
    grep</span> returns an exit status of 0, indicating success; if the pattern 
    is not found, the exit status returned is 1; and if the file is not found, 
    the exit status is 2.</p>
    <p class="docText">The <span class="docEmphasis">grep</span> program can get 
    its input from a standard input or a pipe, as well as from files. If you 
    forget to name a file, <span class="docEmphasis">grep</span> will assume it 
    is getting input from standard input, the keyboard, and will stop until you 
    type something. If coming from a pipe, the output of a command will be piped 
    as input to the <span class="docEmphasis">grep</span> command, and if a 
    desired pattern is matched, <span class="docEmphasis">grep</span> will print 
    the output to the screen.</td>
  </tr>
</table>
  </center>
</div>
<h5 id="ch03list02" class="docExampleTitle">Example 3.2 </h5>
<pre>% <span class="docEmphStrong">ps -ef | grep root</span>
</pre>
<div align="center">
  <center>
<table cellSpacing="0" width="90%" border="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="5">
  <tr>
    <td>
    <h2 class="docSidebarTitle">EXPLANATION</h2>
    <p class="docText">The output of the <span class="docEmphasis">ps</span> 
    command (<span class="docEmphasis">ps 杄f</span> displays all processes 
    running on this system) is sent to <span class="docEmphasis">grep</span> and 
    all lines containing <span class="docEmphasis">root</span> are printed.</td>
  </tr>
</table>
  </center>
</div>
<p class="docText">The <span class="docEmphasis">grep</span> command supports a 
number of regular expression metacharacters (see
<a class="docLink" href="#ch03table01">Table 3.1</a>) to help further define the 
search pattern. It also provides a number of options (see
<a class="docLink" href="#ch03table02">Table 3.2</a>) to modify the way it does 
its search or displays lines. For example, you can provide options to turn off 
case sensitivity, display line numbers, display errors only, and so on.</p>
<h5 id="ch03list03" class="docExampleTitle">Example 3.3 </h5>
<pre>% <span class="docEmphStrong">grep -n  '^jack:' /etc/passwd</span>
</pre>
<div align="center">
  <center>
<table cellSpacing="0" width="90%" border="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="5">
  <tr>
    <td>
    <h2 class="docSidebarTitle">EXPLANATION</h2>
    <p class="docText"><span class="docEmphasis">Grep</span> searches the
    <span class="docEmphasis">/etc/passwd</span> file for
    <span class="docEmphasis">jack;</span> if <span class="docEmphasis">jack</span> 
    is at the beginning of a line, <span class="docEmphasis">grep</span> prints 
    out the number of the line on which <span class="docEmphasis">jack</span> 
    was found and where in the line <span class="docEmphasis">jack</span> was 
    found.</td>
  </tr>
</table>
  </center>
</div>

<p>&nbsp;</p>

<table cellSpacing="0" cellPadding="1" width="100%" border="1">
  <caption>
  <h5 id="ch03table01" class="docTableTitle">Table 3.1. <span class="docEmphasis">grep</span>'s 
  Regular Expression Metacharacters</h5>
  </caption>
  <colgroup span="4" align="left">
  </colgroup>
  <tr>
    <th class="docTableHeader" vAlign="top"><span class="docEmphBoldItalic">
    Metacharacter</span> </th>
    <th class="docTableHeader" vAlign="top"><span class="docEmphBoldItalic">
    Function</span> </th>
    <th class="docTableHeader" vAlign="top"><span class="docEmphBoldItalic">
    Example</span> </th>
    <th class="docTableHeader" vAlign="top"><span class="docEmphBoldItalic">What 
    It Matches</span> </th>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">^</span>
    </td>
    <td class="docTableCell" vAlign="top">Beginning-of-line anchor </td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">'^love'</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches all lines beginning with
    <span class="docEmphasis">love.</span> </td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">$</span>
    </td>
    <td class="docTableCell" vAlign="top">End-of-line anchor </td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">'love$'</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches all lines ending with
    <span class="docEmphasis">love.</span> </td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top">. </td>
    <td class="docTableCell" vAlign="top">Matches one character </td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">'l..e'</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches lines containing an
    <span class="docEmphasis">l,</span> followed by two characters, followed by 
    an <span class="docEmphasis">e.</span> </td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top">* </td>
    <td class="docTableCell" vAlign="top">Matches zero or more characters </td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">' *love'</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches lines with zero or more 
    spaces, followed by the pattern <span class="docEmphasis">love.</span> </td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">[ ]</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches one character in the set </td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">'[Ll]ove'</span>
    </td>
    <td class="docTableCell" vAlign="top">Matches lines containing
    <span class="docEmphasis">love</span> or <span class="docEmphasis">Love.</span>
    </td>
  </tr>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人久久影院| 亚洲第四色夜色| 久久精品国产第一区二区三区| 99久久精品费精品国产一区二区| 日韩你懂的电影在线观看| 亚洲一区视频在线| 99国产麻豆精品| 国产色产综合色产在线视频| 琪琪久久久久日韩精品| 在线观看区一区二| 国产精品国产自产拍高清av王其 | 欧美激情一区不卡| 另类中文字幕网| 精品视频123区在线观看| 中文字幕在线一区免费| 国产成人精品一区二| 日韩欧美自拍偷拍| 亚洲综合色自拍一区| 91网上在线视频| 亚洲欧洲一区二区三区| 国产不卡视频在线观看| 精品处破学生在线二十三| 日本va欧美va欧美va精品| 在线欧美日韩精品| 亚洲品质自拍视频网站| 91一区二区在线| 欧美国产欧美综合| 国产iv一区二区三区| 久久综合久久综合久久综合| 久久成人综合网| 日韩免费在线观看| 久久丁香综合五月国产三级网站| 欧美一级xxx| 玖玖九九国产精品| 精品欧美乱码久久久久久| 蜜桃久久久久久久| 欧美电视剧在线看免费| 麻豆国产精品视频| 日韩欧美电影一区| 久久精品国产精品亚洲红杏| 精品理论电影在线观看| 国产综合色视频| 久久久美女艺术照精彩视频福利播放| 国产曰批免费观看久久久| 天堂va蜜桃一区二区三区| 欧美日韩视频一区二区| 日韩二区在线观看| 精品国产网站在线观看| 九色porny丨国产精品| 2020国产精品自拍| 成人丝袜视频网| 最新欧美精品一区二区三区| 91浏览器打开| 亚洲第一二三四区| 7878成人国产在线观看| 九九久久精品视频 | 91精彩视频在线观看| 一区二区三国产精华液| 欧美日本在线一区| 久久精品av麻豆的观看方式| www激情久久| 成人av资源下载| 一区二区三区视频在线看| 欧美精品日韩一区| 狠狠色丁香九九婷婷综合五月| 欧美极品少妇xxxxⅹ高跟鞋| 色综合天天综合网国产成人综合天 | 日韩精品影音先锋| 国产精品一区二区在线观看网站| 国产精品看片你懂得| 欧美视频第二页| 美女视频黄久久| 中文字幕av一区二区三区高| 91久久久免费一区二区| 美女视频网站久久| 国产精品日产欧美久久久久| 欧美在线观看视频一区二区三区| 蜜桃视频在线一区| 中文字幕中文在线不卡住| 欧美日韩国产高清一区二区| 国产一区高清在线| 一区二区三区四区在线免费观看 | 91麻豆免费观看| 日韩av午夜在线观看| 国产三区在线成人av| 在线观看成人小视频| 国产在线视频不卡二| 亚洲精品精品亚洲| 欧美sm极限捆绑bd| 99久久99久久精品免费看蜜桃| 日韩综合在线视频| 中文字幕国产一区二区| 欧美美女视频在线观看| 国产不卡视频一区| 日韩在线a电影| 亚洲欧洲另类国产综合| 亚洲精品免费在线观看| 日韩欧美第一区| 欧洲精品一区二区三区在线观看| 国产一区二区在线影院| 亚洲无线码一区二区三区| 久久综合av免费| 欧美人狂配大交3d怪物一区| 成人sese在线| 国内精品自线一区二区三区视频| 一区二区高清在线| 久久欧美中文字幕| 欧美日韩精品免费| 不卡的电影网站| 精品中文av资源站在线观看| 一区二区日韩电影| 国产精品欧美精品| 欧美成人精品1314www| 欧美视频完全免费看| www.综合网.com| 国产一区二区久久| 日韩成人av影视| 一区二区三区免费在线观看| 欧美高清在线一区二区| 亚洲精品一区二区三区香蕉| 欧美精品日韩一区| 欧美性猛交xxxx黑人交| youjizz久久| 国产99久久久国产精品免费看| 蜜臀av性久久久久蜜臀aⅴ| 亚洲成人精品在线观看| 亚洲黄色免费网站| 中文字幕一区二区5566日韩| 久久青草国产手机看片福利盒子| 日韩一区二区三| 欧美日韩不卡视频| 欧美色精品在线视频| 色www精品视频在线观看| 成人精品鲁一区一区二区| 精品一二三四区| 久久99久国产精品黄毛片色诱| 日韩av在线播放中文字幕| 一区二区免费在线播放| 亚洲三级在线免费观看| 国产精品你懂的在线欣赏| 久久久久久久一区| 久久久精品一品道一区| 久久免费视频一区| 精品美女一区二区| 精品国产精品一区二区夜夜嗨| 91精品国产欧美日韩| 欧美精品三级在线观看| 7777精品伊人久久久大香线蕉的| 在线观看日韩国产| 欧美体内she精视频| 欧美色视频一区| 欧美日韩电影在线播放| 这里只有精品99re| 欧美一区二区三区成人| 日韩欧美国产综合一区| 欧美电影免费观看高清完整版在 | 欧美日韩一区二区三区四区五区| 在线看日韩精品电影| 在线视频国内一区二区| 欧美性三三影院| 7777精品伊人久久久大香线蕉完整版| 欧美人妖巨大在线| 日韩一区二区不卡| 精品久久99ma| 国产午夜精品理论片a级大结局| 日韩专区一卡二卡| 日本欧美一区二区三区乱码 | 国产日韩三级在线| 国产精品污污网站在线观看 | 欧美一区二区三区电影| 日韩午夜av电影| 久久婷婷综合激情| 国产精品素人一区二区| 亚洲免费观看在线视频| 亚洲五码中文字幕| 蜜臀av在线播放一区二区三区| 国产一区二区在线观看免费| 国产不卡视频在线观看| 色婷婷综合视频在线观看| 欧美日韩精品欧美日韩精品| 日韩三级视频在线看| 国产视频一区不卡| 亚洲欧美激情小说另类| 日欧美一区二区| 国产美女主播视频一区| 91色九色蝌蚪| 337p亚洲精品色噜噜噜| 国产网站一区二区三区| 亚洲精品免费播放| 麻豆精品国产91久久久久久| 成人免费毛片a| 欧美性猛交xxxxxx富婆| 欧美videos大乳护士334| 国产精品狼人久久影院观看方式| 亚洲午夜精品久久久久久久久| 久久99深爱久久99精品| 91首页免费视频| 日韩午夜激情视频| 亚洲视频每日更新| 免费视频一区二区|