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

📄 ch09_02.htm

📁 unix基础教程
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<a name="IXT-9-123186" />Move the lines specified by <em class="emphasis">address</em> to the <em class="emphasis">destination</em> address.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:.,/Note/m /END/    <i class="lineannotation">Move text block after line containing "END"</i></pre></blockquote></td></tr><tr><td valign="top"><a name="next">next</a></a></td><td><p><tt class="literal">n</tt>[<tt class="literal">!</tt>] [[<tt class="literal">+</tt><em class="replaceable"><tt>n</em>] <em class="replaceable">filelist</tt></em>]</p><p><a name="IXT-9-123187" />Edit the next file from the command-line argument list.  Use <tt class="literal">args</tt>to list these files.  If <em class="emphasis">filelist</em> is provided, replace thecurrent argument list with <em class="emphasis">filelist</em> and begin editing on thefirst file.  With the <tt class="literal">+</tt><em class="emphasis">n</em>argument, begin editing on line <em class="emphasis">n</em>.Or <em class="emphasis">n</em> may be a pattern, of the form<tt class="literal">/</tt><em class="emphasis">pattern</em>.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:n chap*            <i class="lineannotation">Start editing all "chapter" files</i></pre></blockquote></td></tr><tr><td valign="top"><a name="number">number</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">nu</tt> [<em class="replaceable">count</tt></em>]</p><p><a name="IXT-9-123188" />Print each line specified by <em class="emphasis">address</em>,preceded by its buffer linenumber.  Use <tt class="literal">#</tt> as an alternate abbreviation for <tt class="literal">number</tt>.<em class="emphasis">count</em> specifies the number of lines to show, starting with <em class="emphasis">address</em>.</p></td></tr><tr><td valign="top"><a name="open">open</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">o</tt> [<tt class="literal">/</tt><em class="replaceable">pattern</tt></em><tt class="literal">/</tt>]</p><p><a name="IXT-9-123189" />Enter open mode (<tt class="literal">vi</tt>) at the lines specified by<em class="emphasis">address</em>, or at thelines matching <em class="emphasis">pattern</em>.Exit open mode with <tt class="literal">Q</tt>.Open mode lets you use the regular <tt class="literal">vi</tt> commands, but only one line at a time.It can be useful on slow dialup lines (or on very distant Internet<tt class="literal">telnet</tt> connections).</p></td></tr><tr><td valign="top"><a name="preserve">preserve</a></a></td><td><p><tt class="literal">pre</tt></p><p><a name="IXT-9-123190" />Save the current editor buffer as though the system were about to crash.</p></td></tr><tr><td valign="top"><a name="print">print</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">p</tt> [<em class="replaceable">count</tt></em>]</p><p><a name="IXT-9-123191" />Print the lines specified by <em class="emphasis">address</em>.  <em class="emphasis">count</em> specifies the number of lines to print, starting with <em class="emphasis">address</em>.<tt class="literal">P</tt> is another abbreviation.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:100;+5p		<i class="lineannotation">Show line 100 and the next five lines</i></pre></blockquote></td></tr><tr><td valign="top"><a name="put">put</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">pu</tt> [<em class="replaceable">char</tt></em>]</p><p><a name="IXT-9-123192" />Restore previously deleted or yanked lines from named buffer specified by<em class="emphasis">char</em>, to the line specified by <em class="emphasis">address</em>.If <em class="emphasis">char</em> is not specified,the last deleted or yanked text is restored.</p></td></tr><tr><td valign="top"><a name="quit">quit</a></a></td><td><p><tt class="literal">q</tt>[<tt class="literal">!</tt>]</p><p><a name="IXT-9-123193" />Terminate current editing session.  Use <tt class="literal">!</tt> to discard changes madesince the last save.  If the editing session includes additional filesin the argument list that were never accessed, quit by typing<tt class="literal">q!</tt> or by typing <tt class="literal">q</tt> twice.</p></td></tr><tr><td valign="top"><a name="read">read</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">r</tt> <em class="replaceable">filename</tt></em></p><p><a name="IXT-9-123194" />Copy the text of <em class="emphasis">filename</em> after the line specified by<em class="emphasis">address</em>.If <em class="emphasis">filename</em> is not specified, the current filename is used.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:0r $HOME/data	<i class="lineannotation">Read file in at top of current file</i></pre></blockquote></td></tr><tr><td valign="top"><a name="read">read</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">r</tt>  <tt class="literal">!</tt><em class="replaceable">command</tt></em></p><p>Read the output of Unix <em class="emphasis">command</em> into the text after the line specified by <em class="emphasis">address</em>.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:$r !cal		<i class="lineannotation">Place a calendar at end of file</i></pre></blockquote></td></tr><tr><td valign="top"><a name="recover">recover</a></a></td><td><p><tt class="literal">rec</tt> [<em class="replaceable"><tt>file</tt></em>]</p><p><a name="IXT-9-123195" />Recover <em class="emphasis">file</em> from the system save area.</p></td></tr><tr><td valign="top"><a name="rewind">rewind</a></a></td><td><p><tt class="literal">rew</tt>[<tt class="literal">!</tt>]</p><p><a name="IXT-9-123196" />Rewind argument list and begin editing the first file in the list.Add a <tt class="literal">!</tt> to rewind even if the current file has not beensaved since the last change.</p></td></tr><tr><td valign="top"><a name="set">set</a></a></td><td><p><tt class="literal">se</tt> <em class="replaceable"><tt>parameter1</em> <em class="replaceable">parameter2</tt></em> ...</p><p><a name="IXT-9-123197" />Set a value to an option with each <em class="emphasis">parameter</em>, or, if no <em class="emphasis">parameter</em> issupplied, print all options that have been changed fromtheir defaults.  For toggle options, each<em class="emphasis">parameter</em> can be phrased as <em class="emphasis">option</em> or <em class="replaceable"><tt>no</em><em class="emphasis">option</tt></em>;other options can be assigned with the syntax <em class="emphasis">option</em><tt class="literal">=</tt><em class="emphasis">value</em>.Specify <tt class="literal">all</tt> to list current settings.The form <tt class="literal">set</tt> <em class="emphasis">option</em><tt class="literal">?</tt>displays the value of <em class="emphasis">option</em>.See the list of <tt class="literal">set</tt> options in<a href="ch08_01.htm">Chapter 8</a>.</p><h4 class="refsect2">Examples</h4><blockquote><pre class="code">:set nows wm=10:set all</pre></blockquote></td></tr><tr><td valign="top"><a name="shell">shell</a></a></td><td><p><tt class="literal">sh</tt></p><p><a name="IXT-9-123198" />Create a new shell.  Resume editing when the shell terminates.</p></td></tr><tr><td valign="top"><a name="source">source</a></a></td><td><p><tt class="literal">so</tt> <em class="replaceable"><tt>file</tt></em></p><p><a name="IXT-9-123199" />Read and execute <tt class="literal">ex</tt> commands from <em class="emphasis">file</em>.</p><h4 class="refsect2">Examples</h4><blockquote><pre class="code">:so $HOME/.exrc</pre></blockquote></td></tr><tr><td valign="top"><a name="substitute">substitute</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">s</tt> [<tt class="literal">/</tt><em class="replaceable">pattern</em><tt class="literal">/</tt><em class="replaceable">replacement</em><tt class="literal">/</tt>] [<em class="replaceable">options</em>] [<em class="replaceable">count</tt></em>]</p><p><a name="IXT-9-123200" />Replace each instance of <em class="emphasis">pattern</em> on the specified lines with <em class="emphasis">replacement</em>.If <em class="emphasis">pattern</em> and <em class="emphasis">replacement</em> are omitted,repeat last substitution.<em class="emphasis">count</em> specifies the number of lines on which to substitute, startingwith <em class="emphasis">address</em>.See additional examples in <a href="ch06_01.htm">Chapter 6</a>.(Spelling out the command name does not work in Solaris <tt class="literal">vi</tt>.)</p><h4 class="refsect2">Options</h4><table border="1" cellpadding="3"><tr><td><tt class="literal">c</tt></td><td><p>Prompt for confirmation before each change.</p></td></tr><tr><td><tt class="literal">g</tt></td><td><p>Substitute all instances of <em class="emphasis">pattern</em> on each line (global).</p></td></tr><tr><td><tt class="literal">p</tt></td><td><p>Print the last line on which a substitution was made.</p></td></tr></table><p><h4 class="refsect2">Examples</h4><blockquote><pre class="code">:1,10s/yes/no/g      <i class="lineannotation">Substitute on first 10 lines</i>:%s/[Hh]ello/Hi/gc   <i class="lineannotation">Confirm global substitutions</i>:s/Fortran/\U&amp;/ 3    <i class="lineannotation">Uppercase "Fortran" on next three lines</i></pre></blockquote></td></tr><tr><td valign="top"><a name="t">t</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">t</tt> <em class="replaceable">destination</tt></em></p><p><a name="IXT-9-123201" />Copy the lines included in <em class="emphasis">address</em> <b class="emphasis-bold"><a href="#t">t</a></b>o thespecified <em class="emphasis">destination</em> address.<tt class="literal">t</tt> is equivalent to <tt class="literal">copy</tt>.</p><h4 class="refsect2">Example</h4><blockquote><pre class="code">:%t$               <i class="lineannotation">Copy the file and add it to the end</i></pre></blockquote></td></tr><tr><td valign="top"><a name="tag">tag</a></a></td><td><p>[<em class="replaceable"><tt>address</em>] <tt class="literal">ta</tt> <em class="replaceable">tag</tt></em></p><p><a name="IXT-9-123202" />Switch the focus of editing to <em class="emphasis">tag</em>.</p><h4 class="refsect2">Example</h4><p>Run <tt class="literal">ctags</tt>, then switch to the file containing <em class="emphasis">myfunction</em>:</p><blockquote><pre class="code">:!ctags *.c:tag <em class="replaceable"><tt>myfunction</tt></em></pre></blockquote></td></tr><tr><td valign="top"><a name="unabbreviate">unabbreviate</a></a></td><td><p><tt class="literal">una</tt> <em class="replaceable"><tt>word</tt></em></p><p><a name="IXT-9-123203" />Remove <em class="emphasis">word</em> from the list of abbreviations.</p></td></tr><tr><td valign="top"><a name="undo">undo</a></a></td><td><p><tt class="literal">u</tt></p><p>

⌨️ 快捷键说明

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