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

📄 ex.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<p>If the<i>file</i>is preceded by"!",the program named in the<i>SHELL</i>environment variable will beinvoked with<i>file</i>as its second argument, and the specifiedlines will be passed as standard input to the command.The<b>!</b>in this usage must be separated from the<b>w</b>command by at least oneblankcharacter.The special meaning of the<b>!</b>can beoverridden by escaping it with a backslash character.This command is affected by the editor options<b>writeany</b>and<b>readonly</b>.<p>The command<b>wq</b>is equivalent to a<b>w</b>followedby a<b>q</b>;<b>wq!</b>is equivalent to<b>w!</b>followed by<b>q</b>.If the current buffer has no pathname associated with it, the<b>write</b>command will fail.<h5><a name = "tag_001_014_598_040">&nbsp;</a>Write and Exit</h5><i>Synopsis</i>:   <b>[</b><i>range</i><b>] </b>x<b>[</b>it<b>][</b>!<b>] [</b><i>file</i><b>]</b><p>Perform a<b>write</b>commandif any changes have been made to the current buffersince the last write to any file.The<i>range</i>defaults to the entire file.<p>Unless the command fails because an attempt towrite lines to a file did not succeed, the<i>ex</i>utility will exit after an<b>x</b>command.This command is affected by the editor options<b>writeany</b>and<b>readonly</b>.<h5><a name = "tag_001_014_598_041">&nbsp;</a>Yank</h5><i>Synopsis</i>:   <b>[</b><i>range</i><b>] </b>ya<b>[</b>nk<b>] [</b><i>buffer</i><b>] [</b><i>count</i><b>]</b><p>Place the specified lines in the named buffer.If no buffer is specified, the unnamed buffer will be used(where the most recently deleted or yanked text is placed by default).<h5><a name = "tag_001_014_598_042">&nbsp;</a>Adjust Window</h5><i>Synopsis</i>:   <b>[</b><i>line</i><b>] </b>z <b>[</b><i>type</i><b>] [</b><i>count</i><b>] [</b><i>flags</i><b>]</b><p>If<i>type</i>is omitted, then<i>count</i>lines following the specified line(<i>line</i>)will be written.The default for<i>count</i>is the value of the editor option<b>window</b>.The<i>type</i>argument will change the position at which<i>line</i>will be written on the screen by affecting the number oflines written before and after<i>line</i>.<p>If<i>type</i>is specified, it will be one of the following:<dl compact><dt><b>-</b><dd>Place<i>line</i>at the bottom of the screen.<dt><b>+</b><dd>Place<i>line</i>at the top of the screen.<dt><b>.</b><dd>Place<i>line</i>in the middle.<dt><b>^</b><dd>Write out<i>count</i>lines starting<i>count</i>*2lines before the addressed line; the net effect of this will be that a<b>z^</b>command following another<b>z</b>command writes the previous page.<dt><b>=</b><dd>Centre the addressed lineon the screen with a line of hyphens writtenimmediately before and after it.The number of preceding andfollowing lines of text written will be reduced to account forthese lines of hyphens.</dl><p>In all cases thecurrent line indicator will be set tothe last line written, with the exception of the"="type, which causes the current line indicator to be set tothat addressed in the command.<h5><a name = "tag_001_014_598_043">&nbsp;</a>Escape</h5><i>Synopsis</i>:   ! <i>command</i><br><i>Synopsis</i>:   <b>[</b><i>range</i><b>]</b>! <i>command</i><p>Pass the remainder of the line after the<b>!</b>character to the program named in the<i>SHELL</i>environment variable for execution.A warning will be issued if the buffer has been changed since the last write.A single<b>!</b>character will be written when the command completes.The current line position will not be affected.<p>Within the text of<i>command</i>,<b>%</b>and<b>#</b>will be expanded as pathnames (the current and alternative pathnames,respectively),and<b>!</b>will be replaced with the text of the previous<b>!</b>command.(Thus,<b>!!</b>will repeat the previous<b>!</b>command.)If any such expansion is done, the expanded line will be echoed.<p>The special meanings of<b>%</b>,<b>#</b>and<b>!</b>can be overridden byescaping them with a backslash character.This command is affected by the editor options<b>autowrite</b>and<b>writeany</b>;see<xref href=exedops><a href="#tag_001_014_598_052">Edit Options in ex</a></xref>for details.<p>In the second form of the<b>!</b>command, the remainder of the line after the<b>!</b>will be passed to theprogram named in the<i>SHELL</i>environment variable, as described above.The specified lineswill be provided to the programas standard input;the resulting output will replace the specified lines.<h5><a name = "tag_001_014_598_044">&nbsp;</a>Shift Left</h5><i>Synopsis</i>:   <b>[</b><i>range</i><b>]</b> &lt; <b>[</b><i>count</i><b>] [</b><i>flags</i><b>]</b><p>Shift the specified lines to the left;the number of character positionsto be shifted will be determined by the editor option<b>shiftwidth</b>.Only leadingblank characterswill be lost in shifting; other characterswill not be affected.The current line indicator will be set to the last line changed.<h5><a name = "tag_001_014_598_045">&nbsp;</a>Shift Right</h5><i>Synopsis</i>:   <b>[</b><i>range</i><b>]</b> &gt; <b>[</b><i>count</i><b>] [</b><i>flags</i><b>]</b><p>Shift the specified lines to the right, by insertingblank characters,usingtab characterswhere possible, as determined by the editor option<b>shiftwidth</b>.Empty lines will not be changed.The current line indicator will be set to the last line changed.<h5><a name = "tag_001_014_598_046">&nbsp;</a>Resubstitute</h5><i>Synopsis</i>:   <b>[</b><i>range</i><b>] </b>&amp; <b>[</b><i>options</i><b>] [</b><i>count</i><b>] [</b><i>flags</i><b>]</b><br><i>Synopsis</i>:   <b>[</b><i>range</i><b>] </b>s<b>[</b>ubstitute<b>] [</b><i>options</i><b>] [</b><i>count</i><b>] [</b><i>flags</i><b>]</b><br><i>Synopsis</i>:   <b>[</b><i>range</i><b>] ~ </b> <b>[</b><i>options</i><b>] [</b><i>count</i><b>] [</b><i>flags</i><b>]</b><p>Repeat the previous substitute command, as if &amp; were replaced by theprevious:<pre><code>s/<i>pattern</i>/<i>repl</i>/</code></pre>command.The same effect can obtained by omitting the:<pre><code>/<i>pattern</i>/<i>repl</i>/</code></pre>string in the<b>substitute</b>command.The version of the command using tilde will be the same as &amp; and<b>s</b>,but the<i>pattern</i>used will be the last regular expression used in any command,not necessarily the one used in the last substitute command.For example, in the sequence:<pre><code>s/red/blue//green~</code></pre>the "~" is equivalent to:<pre><code>s/green/blue/</code></pre><h5><a name = "tag_001_014_598_047">&nbsp;</a>Scroll</h5><xref type="5" name="scroll"></xref><i>Synopsis</i>:   <i>eof</i><p>Write the next<i>n</i>lines, where<i>n</i>is the value of the editor option<b>scroll</b>.The command is invoked with the<b>eof</b>character (see the description of the<i><a href="stty.html">stty</a></i><b>eof</b>character).The current line indicator will be set to the last line written.This command need not be supported on block-mode terminals.<h5><a name = "tag_001_014_598_048">&nbsp;</a>Write Line Number</h5><i>Synopsis</i>:   <b>[</b><i>line</i><b>] </b>= <b>[</b><i>flags</i><b>]</b><p>Write the line number of the specified line (default last line).The current line position will not be affected.<h5><a name = "tag_001_014_598_049">&nbsp;</a>Execute</h5><i>Synopsis</i>:    @ <i>buffer</i><br><i>Synopsis</i>:   * <i>buffer</i><p>Execute each line of the named buffer as an<i>ex</i>command.If no buffer is specified or is specified as "@" or "*",the last buffer executed will be used.If there is no last buffer,an error occurs.<h5><a name = "tag_001_014_598_050">&nbsp;</a>Regular Expressions in ex</h5><xref type="5" name="exre"></xref>The<i>ex</i>utility supports the basic regular expressions described inthe <b>XBD</b> specification, <a href="../xbd/re.html#tag_007_003"><b>Basic Regular Expressions</b>&nbsp;</a> .A null RE(//)is equivalent to the last RE encountered.<p>Regular expressions can be used in addresses to specify lines and, in somecommands (for example, the<b>substitute</b>command), to specify portions of a line to be substituted.<p>The following constructs can be used to enhance thebasic regular expressions:<dl compact><dt>\&lt;<dd>Match the beginning of a<i>word</i>.(See the definition of<i>word</i>at the beginning of<xref href=excmd><a href="#tag_001_014_598_002">Command Descriptions in ex</a></xref>.)<dt>\&gt;<dd>Match the end of a<i>word</i>.<dt>~<dd>Match the replacement part of the last<b>substitute</b>command.The tilde(~)character can be escaped in a regular expression to becomea normal character with no special meaning.</dl><p>Whenthe editor option<b>nomagic</b>is set, the only characters with special meanings are "^"at the beginning of a pattern, "$" at the end of a pattern, and "\".The characters ".", "*", "[" and "~" are treated as ordinary charactersunless preceded by a "\";when preceded by a "\" they regain their special meaning.<h5><a name = "tag_001_014_598_051">&nbsp;</a>Replacement Strings in ex</h5><xref type="5" name="exrep"></xref>The character &amp;(\&amp; if the editor option<b>nomagic</b>is set)in the replacement string will stand for thetext matched by the pattern to be replaced.The character~ (\~if<b>nomagic</b>is set)will be replaced by the replacement part of theprevious substitute command.The sequence\<i>n</i>where<i>n</i>is an integer, will be replaced bythe text matched by the pattern enclosed in the<i>n</i>thset of parentheses\(and\).<p>The strings\l,\u,\Land\Ucan be used to modify the case of elements inthe replacement string (using the\&amp;or\&lt;digit&gt;notation.The string\l(\u)causes the first character (actually inserted by thesubstitution) that follows the\l(\u)to be converted to lower-case (upper-case).The strings\L(\U)causes all characters subsequentto them to be converted to lower-case (upper-case) as they are insertedby the substitution until the string\eor\E,or the end of thereplacement string, is encountered.<p>An example of case conversion with the<b>s</b>command is as follows:<pre><code><b>:</b>p<b>The cat sat on the mat.</b><b>:</b>s/\&lt;.at\&gt;/\u&amp;/gp<b>The Cat Sat on the Mat.</b><b>:</b>s/S\(.*\)M/S\U\1\eM/p<b>The Cat SAT ON THE Mat.</b></code></pre><p>In visual mode, a &lt;control&gt;-V &lt;control&gt;-M (or &lt;control&gt;-Q &lt;control&gt;-M)sequence in the replacement string will be mapped to anewline character, and so can be used to split lines.A literal &lt;control&gt;-M requires escaping by preceding it with a backslash(\^V^Mor\^Q^M).<h5><a name = "tag_001_014_598_052">&nbsp;</a>Edit Options in ex</h5><xref type="5" name="exedops"></xref>The<i>ex</i>utility has a number of options that modify its behaviour.These options have default settings, which can be changed using the<b>set</b>command.<p>Options are Boolean unless otherwise specified.<h5><a name = "tag_001_014_598_053">&nbsp;</a>autoindent, ai</h5>[Default <i>off</i>]<p>If<b>autoindent</b>is set, each line in input mode will be indented(using first as many tab characters as possible,as determined by the editor option<b>tabstop</b>,and then using space characters) to align with the previous line.(Starting indentation will be determined by the line appended after, or theline inserted before or the first line changed, with an<b>a</b>,<b>i</b>or<b>c</b>command, respectively.)When a newline character is inserted in the middle of a line,and when<b>autoindent</b>is on, the first non-blank character tothe right of the cursor will be aligned to the current marginon a new line immediately following the current line.Any blank characters

⌨️ 快捷键说明

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