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

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

?? _chapter 2.htm

?? linux、unix初學者的必讀書籍 詳細講述了shell編程方法與技巧
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<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 2</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 1.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 3.htm"><img src="Rarrow.gif" width="17" height="19" border="0"></a></td></tr></table>


<h2 class="docChapterTitle">Chapter 2. The UNIX Toolbox</h2><ul><li>&nbsp;<a class="docLink" href="#ch02lev1sec1">2.1 Regular Expressions</a></li>
<li>&nbsp;<a class="docLink" href="#ch02lev1sec2">2.2 Combining Regular Expression Metacharacters</a></li>
</ul>
<p class="docText">
<img alt="graphics/ch02.gif" src="ch02.gif" border="0" width="497" height="350"></p>
<p class="docText">There are hundreds of UNIX utilities available, and many of 
them are everyday commands such as <span class="docEmphasis">ls, pwd,</span>
<span class="docEmphasis">who</span>, and <span class="docEmphasis">vi</span>. 
Just as there are essential tools that a carpenter uses, there are also 
essential tools the shell programmer needs to write meaningful and efficient 
scripts. The three major utilities that will be discussed in detail here are
<span class="docEmphasis">grep, sed</span>, and <span class="docEmphasis">awk</span>. 
These programs are the most important UNIX tools available for manipulating 
text, output from a pipe, or standard input. In fact, <span class="docEmphasis">
sed</span> and <span class="docEmphasis">awk</span> are often used as scripting 
languages by themselves. Before you fully appreciate the power of
<span class="docEmphasis">grep,</span> <span class="docEmphasis">sed</span>, and
<span class="docEmphasis">awk</span>, you must have a good foundation on the use 
of regular expressions and regular expression metacharacters. A complete list of 
useful UNIX utilities is found in
<a class="docLink" href="Appendix A.htm">Appendix A</a> of 
this book.</p>
<h3 class="docSection1Title" id="ch02lev1sec1">2.1 Regular Expressions</h3>
<h4 class="docSection2Title" id="ch02lev2sec1">2.1.1 Definition and Example</h4>
<p class="docText">For users already familiar with the concept of regular 
expression metacharacters, this section may be bypassed. However, this 
preliminary material is crucial to understanding the variety of ways in which
<span class="docEmphasis">grep, sed</span>, and <span class="docEmphasis">awk</span> 
are used to display and manipulate data.</p>
<p class="docText">What is a regular expression? A regular expression<span id="ENB2-1"><a class="docLink" href="#EN2-1"><sup>[1]</sup></a></span> 
is just a pattern of characters used to match the same characters in a search. 
In most programs, a regular expression is enclosed in forward slashes; for 
example, <span class="docEmphasis">/love/</span> is a regular expression 
delimited by forward slashes, and the pattern <span class="docEmphasis">love</span> 
will be matched any time the same pattern is found in the line being searched. 
What makes regular expressions interesting is that they can be controlled by 
special metacharacters. If you are new to the idea of regular expressions, let 
us look at an example that will help you understand what this whole concept is 
about. Suppose that you are working in the <span class="docEmphasis">vi</span> 
editor on an e-mail message to your friend. It looks like this:</p>
<pre>% <span class="docEmphStrong">vi letter</span>
------------------------------------------------------------------
Hi tom,
I think I failed my anatomy test yesterday. I had a terrible
stomach ache. I ate too many fried green tomatoes.
Anyway, Tom, I need your help. I'd like to make the test up
tomorrow, but don't know where to begin studying. Do you
think you could help me? After work, about 7 PM, come to
my place and I'll treat you to pizza in return for your help. Thanks.
                                      Your pal,
                                      guy@phantom

~
~
~
~
------------------------------------------------------------------
</pre>
<p class="docText">Now, suppose you find out that Tom never took the test 
either, but David did. You also notice that in the greeting, you spelled
<span class="docEmphasis">Tom</span> with a lowercase <span class="docEmphasis">
t.</span> So you decide to make a global substitution to replace all occurrences 
of <span class="docEmphasis">tom</span> with <span class="docEmphasis">David</span>, 
as follows:</p>
<pre>% <span class="docEmphStrong">vi letter</span>
------------------------------------------------------------------
Hi <span class="docEmphasis">David,</span>
I think I failed my ana<span class="docEmphasis">David</span>y test yeserday. I had a terrible
s<span class="docEmphasis">David</span>achache. I think I ate too many fried green <span class="docEmphasis">David</span>atoes.
Anyway, Tom, I need your help. I'd like to make the test up
<span class="docEmphasis">David</span>orrow, but don't know where to begin studying. Do you
think you could help me? After work, about 7 PM, come to
my place and I'll treat you to pizza in return for your help. Thanks.
                                      Your pal,
                                      guy@phan<span class="docEmphasis">David</span>

~
~
~


--&gt; <span class="docEmphStrong">:1,$s/tom/David/g</span>
------------------------------------------------------------------
</pre>
<p class="docText">The regular expression in the search string is
<span class="docEmphasis">tom.</span> The replacement string is
<span class="docEmphasis">David.</span> The <span class="docEmphasis">vi</span> 
command reads &quot;for lines 1 to the end of the file ($), substitute
<span class="docEmphasis">tom</span> everywhere it is found on each line and 
replace it with <span class="docEmphasis">David</span>.&quot; Hardly what you want! 
And one of the occurrences of <span class="docEmphasis">Tom</span> was untouched 
because you only asked for <span class="docEmphasis">tom</span>, not
<span class="docEmphasis">Tom</span>, to be replaced with
<span class="docEmphasis">David</span>. So what to do?</p>
<p class="docText">Regular expression metacharacters are special characters that 
allow you to delimit a pattern in some way so that you can control what 
substitutions will take place. There are metacharacters to anchor a word to the 
beginning or end of a line. There are metacharacters that allow you to specify 
any characters, or some number of characters, to find both upper- and lowercase 
characters, digits only, and so forth. For example, to change the name
<span class="docEmphasis">tom</span> or <span class="docEmphasis">Tom</span> to
<span class="docEmphasis">David</span>, the following <span class="docEmphasis">
vi</span> command would have done the job:</p>
<pre><span class="docEmphStrong">:1,$s/\&lt;[Tt]om\&gt;/David/g</span>
</pre>
<p class="docText">This command reads, &quot;From the first line to the last line of 
the file (<span class="docEmphasis">1,$</span>), substitute (<span class="docEmphasis">s</span>) 
the word <span class="docEmphasis">Tom</span> or <span class="docEmphasis">tom</span> 
with <span class="docEmphasis">David</span>,&quot; and the <span class="docEmphasis">
g</span> flag says to do this globally (i.e., make the substitution if it occurs 
more than once on the same line). The regular expression metacharacters are \&lt; 
and \&gt; for beginning and end of a word, and the pair of brackets, [<span class="docEmphasis">Tt</span>], 
match for one of the characters enclosed within them (in this case, for either
<span class="docEmphasis">T</span> or <span class="docEmphasis">t</span>). There 
are five basic metacharacters that all UNIX pattern-matching utilities 
recognize, and then an extended set of metacharacters that vary from program to 
program.</p>
<h4 class="docSection2Title" id="ch02lev2sec2">2.1.2 Regular Expression Metacharacters</h4>
<p class="docText"><a class="docLink" href="#ch02table01">Table 2.1</a> presents 
regular expression metacharacters that can be used in all versions of
<span class="docEmphasis">vi, ex, grep, egrep, sed</span>, and
<span class="docEmphasis">awk.</span> Additional metacharacters are described 
for each of the utilities where applicable.</p>
<table cellSpacing="0" cellPadding="1" width="100%" border="1">
  <caption>
  <h5 id="ch02table01" class="docTableTitle">Table 2.1. 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"><span class="docEmphasis">*</span></td>
    <td class="docTableCell" vAlign="top">Matches zero or more of the preceding 
    characters</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/ *love/</span></td>
    <td class="docTableCell" vAlign="top">Match 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 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>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">[x杫]</span></td>
    <td class="docTableCell" vAlign="top">Matches one character within a range 
    in the set</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/[A朲]ove/</span></td>
    <td class="docTableCell" vAlign="top">Matches letters from
    <span class="docEmphasis">A</span> through <span class="docEmphasis">Z</span> 
    followed by <span class="docEmphasis">ove</span>.</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">[^ ]</span></td>
    <td class="docTableCell" vAlign="top">Matches one character not in the set</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/[^A朲]/</span></td>
    <td class="docTableCell" vAlign="top">Matches any character not in the range 
    between <span class="docEmphasis">A</span> and <span class="docEmphasis">Z</span>.</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">\</span></td>
    <td class="docTableCell" vAlign="top">Used to escape a metacharacter</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/love\./</span></td>
    <td class="docTableCell" vAlign="top">Matches lines containing
    <span class="docEmphasis">love</span>, followed by a literal period. 
    Normally the period matches one of any character.</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top" colSpan="4">
    <span class="docEmphBoldItalic">Additional metacharacters are supported by 
    many UNIX programs that use RE metacharacters:</span></td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">\&lt;</span></td>
    <td class="docTableCell" vAlign="top">Beginning-of-word anchor</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/\&lt;love/</span></td>
    <td class="docTableCell" vAlign="top">Matches lines containing a word that 
    begins with <span class="docEmphasis">love</span> (supported by
    <span class="docEmphasis">vi</span> and <span class="docEmphasis">grep</span>).</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">\&gt;</span></td>
    <td class="docTableCell" vAlign="top">End-of-word anchor</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">/love\&gt;/</span></td>
    <td class="docTableCell" vAlign="top">Matches lines containing a word that 
    ends with <span class="docEmphasis">love</span> (supported by
    <span class="docEmphasis">vi</span> and <span class="docEmphasis">grep</span>).</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">\(..\)</span></td>
    <td class="docTableCell" vAlign="top">Tags match characters to be used later</td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">
    /\(love\)able \1er/</span></td>
    <td class="docTableCell" vAlign="top">May use up to nine tags, starting with 
    the first tag at the left-most part of the pattern. For example, the pattern
    <span class="docEmphasis">love</span> is saved as tag 1, to be referenced 
    later as <span class="docEmphasis">\1</span>; in this example, the search 
    pattern consists of <span class="docEmphasis">lovable</span> followed by
    <span class="docEmphasis">lover</span> (supported by
    <span class="docEmphasis">sed, vi,</span> and <span class="docEmphasis">grep</span>).</td>
  </tr>
  <tr>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">x{m\}</span>or
    <span class="docEmphasis">x{m,\}</span>or <span class="docEmphasis">x{m,n\}</span></td>
    <td class="docTableCell" vAlign="top">Repetition of character x, m times, at 
    least m times, at least m and not more than n times<sup class="docFootnote"><a class="docLink" href="#ch02tabfn01">[a]</a></sup></td>
    <td class="docTableCell" vAlign="top"><span class="docEmphasis">o{5,10\}</span></td>
    <td class="docTableCell" vAlign="top">Matches if line contains between 5 and
    <span class="docEmphasis">10</span> consecutive occurrences of the letter
    <span class="docEmphasis">o</span> (supported by <span class="docEmphasis">
    vi</span> and <span class="docEmphasis">grep</span>).</td>
  </tr>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产日韩精品免费观看| 欧美做爰猛烈大尺度电影无法无天| 99re亚洲国产精品| 国产女同性恋一区二区| 99久久99久久精品国产片果冻| 韩国一区二区在线观看| 久久麻豆一区二区| 国产精品一二二区| 亚洲一区二区三区中文字幕在线 | 91成人免费电影| 亚洲一区二区三区在线| 一二三四区精品视频| 宅男在线国产精品| 日韩高清中文字幕一区| 亚洲精品在线观看网站| 成人蜜臀av电影| 亚洲成人动漫一区| 国产人久久人人人人爽| 国产精品毛片a∨一区二区三区| 一本色道久久综合精品竹菊| 蜜臀久久久99精品久久久久久| 久久精品视频免费| 777午夜精品免费视频| 日韩欧美一区二区三区在线| 懂色av一区二区在线播放| 日韩成人dvd| 国产精品18久久久久久久久 | 精品久久久三级丝袜| 91网页版在线| 国产资源在线一区| 丁香六月久久综合狠狠色| 91色乱码一区二区三区| 在线播放91灌醉迷j高跟美女| 国内偷窥港台综合视频在线播放| 国产乱人伦精品一区二区在线观看| 国产精品一级片| 在线观看国产日韩| 久久久久久久久久久久久女国产乱| 国产精品久99| 久久久一区二区三区| 亚洲人快播电影网| 国产午夜精品久久久久久免费视 | 97久久精品人人爽人人爽蜜臀| 99re免费视频精品全部| 欧美久久久久免费| 国产精品天干天干在线综合| 亚洲图片欧美一区| 亚洲免费在线观看视频| 国产一区二区三区国产| 国产精品一区在线| 在线播放中文字幕一区| 亚洲欧美一区二区视频| 亚洲图片另类小说| 亚洲一级二级在线| av在线综合网| 欧美在线观看禁18| 欧美国产日韩a欧美在线观看| 奇米色777欧美一区二区| 青青草精品视频| 欧美性受xxxx黑人xyx| 欧美日韩成人一区| 7777精品伊人久久久大香线蕉超级流畅| 国产亚洲欧美激情| 久久不见久久见免费视频1| 国产伦精品一区二区三区免费迷| 欧美视频第二页| 一区二区三区日韩精品| 国产成人免费网站| 一本久道中文字幕精品亚洲嫩| www成人在线观看| 国产精品黄色在线观看| 国产大陆a不卡| 精品乱码亚洲一区二区不卡| 视频在线观看91| 国产乱理伦片在线观看夜一区| 91精品国产综合久久福利软件| 久久夜色精品国产欧美乱极品| 日日摸夜夜添夜夜添国产精品| 欧美性生活影院| 一区二区三区精品在线| 在线观看91视频| 亚洲一级片在线观看| 欧美日韩国产天堂| 午夜久久福利影院| 国产精品中文字幕日韩精品 | 不卡一二三区首页| 欧美裸体bbwbbwbbw| 亚洲一区二区三区四区五区黄| 91福利社在线观看| 亚洲综合色网站| 欧美日韩一区不卡| 中文成人综合网| 99久久精品久久久久久清纯| 亚洲三级免费电影| 欧美日韩一区二区三区四区| 午夜电影网一区| 久久无码av三级| 成人精品鲁一区一区二区| 国产欧美一二三区| 欧美影院精品一区| 五月激情六月综合| 精品粉嫩超白一线天av| 成人aa视频在线观看| 亚洲一区二区三区三| 精品视频一区 二区 三区| 蜜臀久久99精品久久久久久9| 久久欧美中文字幕| 91丨九色丨国产丨porny| 丝袜亚洲另类丝袜在线| 久久久久久久久久久久久女国产乱| gogo大胆日本视频一区| 婷婷开心激情综合| 欧美精品一区二区三区很污很色的 | 日韩欧美国产精品| 成人黄色a**站在线观看| 亚洲成av人片| 日本一区二区视频在线观看| 欧美午夜精品一区二区三区| 国产美女在线精品| 亚洲3atv精品一区二区三区| 中文字幕的久久| 欧美一区二区三区在线观看视频| 成人看片黄a免费看在线| 日韩av电影天堂| 国产精品久久久久久久久久免费看 | 日本不卡123| 亚洲人被黑人高潮完整版| 日韩精品一区二区在线| 欧美在线一二三| av高清久久久| 国产一区二区按摩在线观看| 婷婷久久综合九色综合绿巨人 | 日本中文一区二区三区| 日韩一区精品视频| 国产精品久久久久久亚洲伦| 日韩美女主播在线视频一区二区三区| 在线一区二区观看| 成人av电影在线观看| 国产精品自产自拍| 狠狠色2019综合网| 日本欧美一区二区在线观看| 亚洲1区2区3区视频| 亚洲综合999| 亚洲欧美另类久久久精品2019| 久久久www免费人成精品| 欧美电视剧免费观看| 777xxx欧美| 91精品国产欧美一区二区成人| 欧美在线播放高清精品| 99久久婷婷国产精品综合| 福利一区二区在线| 国产成人av福利| 国产传媒一区在线| 成人性生交大片| 国产sm精品调教视频网站| 国产成人在线免费| 成人晚上爱看视频| 99久久久精品| 91久久久免费一区二区| 色妞www精品视频| 91国产丝袜在线播放| 欧美影视一区在线| 91麻豆精品91久久久久同性| 欧美剧情片在线观看| 91精品国产91综合久久蜜臀| 91精品国产综合久久久久久漫画| 91麻豆精品久久久久蜜臀 | 黄色资源网久久资源365| 韩国欧美一区二区| 国产一区二区三区久久悠悠色av| 国产馆精品极品| www.综合网.com| 欧美视频第二页| 精品成人a区在线观看| 国产日韩精品一区二区浪潮av| 欧美国产欧美综合| 一区二区三区蜜桃网| 日韩国产一区二| 国产91露脸合集magnet| 91视频在线观看| 91精品国产免费久久综合| 久久日韩精品一区二区五区| 中文字幕中文在线不卡住| 亚洲电影在线播放| 精品一区二区三区蜜桃| 亚洲伦在线观看| 欧美军同video69gay| 欧美va亚洲va在线观看蝴蝶网| 亚洲国产精品t66y| 亚洲午夜私人影院| 精品亚洲成a人| 一本到高清视频免费精品| 欧美一区二区播放| 国产精品久久久久毛片软件| 亚洲va欧美va人人爽| 国产电影精品久久禁18| 在线成人免费视频| 亚洲色图在线播放| 久久99精品久久久久久国产越南| 欧美一区二区日韩|