Mercurial > hg > Members > kono > nitros9-code
view 3rdparty/packages/ed/ed.refentry @ 1530:a02b18bfc376
New 'Old' fields added from OS-9 Level One V2.00.00 Addendum
author | boisy |
---|---|
date | Wed, 14 Apr 2004 13:35:50 +0000 |
parents | bef1844de0dc |
children |
line wrap: on
line source
<refentry id="ed"> <refnamediv> <refname>ED</refname> <refpurpose>editor</refpurpose> </refnamediv> <refsynopsisdiv> <cmdsynopsis> <command>ED</command> <arg choice="plain"><replaceable>file</replaceable></arg> <arg choice="opt">-</arg> </cmdsynopsis> </refsynopsisdiv> <refsect1><title>Options</title> <para> "-" Suppress line/byte count messages (for in scripts) </para> </refsect1> <refsect1><title>Examples</title> <screen> ed prog.c Edit <filename>prog.c</filename> echo '1,$p' | ed - file Odd way to write 'cat file' </screen> </refsect1> <refsect1><title>Description</title> <para> <command>Ed</command> is functionally equivalent to the standard UNIX V7 editor, ed. It supports the following commands: </para> <informaltable frame="none"> <tgroup cols="2"> <colspec colwidth="0.7in"/> <colspec colwidth="2.95in"/> <tbody> <row> <entry>(.)</entry><entry>a: append</entry> </row> <row> <entry>(.,.)</entry><entry>c: change</entry> </row> <row> <entry>(.,.)</entry><entry>d: delete</entry> </row> <row> <entry></entry><entry>e: edit new file"</entry> </row> <row> <entry></entry><entry>f: print name of edited file"</entry> </row> <row> <entry>(1,$)</entry><entry>g: global command</entry> </row> <row> <entry>(.)</entry><entry>i: insert</entry> </row> <row> <entry>(.,.+1)</entry><entry>j: join lines together</entry> </row> <row> <entry>(.)</entry><entry>k: mark</entry> </row> <row> <entry>(.)</entry><entry>l: print with special characters in octal</entry> </row> <row> <entry>(.,.)</entry><entry>m: move</entry> </row> <row> <entry>(.,.)</entry><entry>p: print</entry> </row> <row> <entry></entry><entry>q: quit editor"</entry> </row> <row> <entry>(.)</entry><entry>r: read in new file</entry> </row> <row> <entry>(.,.)</entry><entry>s: substitute</entry> </row> <row> <entry>(1,$)</entry><entry>v: like g, except select lines that do not match</entry> </row> <row> <entry>(1,$)</entry><entry>w: write out edited file</entry> </row> </tbody> </tgroup> </informaltable> <para> Many of the commands can take one or two addresses, as indicated above. The defaults are shown in parentheses. Thus <command>a</command> appends to the current line, and <command>g</command> works on the whole file as default. The dot refers to the current line. Below is a sample editing session with comments given following the # symbol. </para> <informaltable frame="none"> <tgroup cols="2"> <colspec colwidth="1.3in"/> <colspec colwidth="3.5in"/> <tbody> <row> <entry>ed prog.c</entry><entry># Edit prog.c</entry> </row> <row> <entry>3,20p</entry><entry># Print lines 3 through 20</entry> </row> <row> <entry>/whole/</entry><entry># Find next occurence of <replaceable>whole</replaceable></entry> </row> <row> <entry>s/whole/while/</entry><entry># Replace <replaceable>whole</replaceable> by <replaceable>while</replaceable></entry> </row> <row> <entry>g/Buf/s//BUF/g</entry><entry># Replace <replaceable>Buf</replaceable> by <replaceable>BUF</replaceable> everywhere</entry> </row> <row> <entry>w</entry><entry># Write the file back</entry> </row> <row> <entry>q</entry><entry># Exit the editor</entry> </row> </tbody> </tgroup> </informaltable> <para> <command>Ed</command> is provided for its sentimental value. </para> </refsect1> </refentry>