.\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)ex.1 8.1 (Berkeley) 6/21/93 .\" .Dd June 21, 1993 .Dt EX 1 .Os BSD 4 .Sh NAME .Nm ex , edit .Nd text editor .Sh SYNOPSIS .Nm ex .Op Fl .Op Fl v .Op Fl t Ar tag .Op Fl r .Oo .Op Cm + Ns Ar command .Oc .Op Fl l .Ar name \&... .Nm edit .Op ex options .Sh DESCRIPTION .Nm \&Ex is the root of a family of editors: .Nm edit , .Nm ex and .Nm vi . .Nm \&Ex is a superset of .Xr ed , with the most notable extension being a display editing facility. Display based editing is the focus of .Xr vi 1 and requires a .Tn CRT . .Pp For users unfamiliar with .Xr ed 1 , the editor .Nm edit is probably easier to learn. It avoids some of the complexities of .Nm ex used mostly by systems programmers and persons comfortable with the .Xr ed 1 editor. .Sh DOCUMENTATION The following documentation is found in the .Dq "UNIX User's Manual Supplementary Documents" : .Pp .%T "Edit: A tutorial" provides a comprehensive introduction to .Nm edit assuming no previous knowledge of computers or the .Tn UNIX system. .Pp .%T "Ex Reference Manual \- Version 3.7" is a comprehensive and complete manual for the command mode features of .Nm ex , but you cannot learn to use the editor by reading it. For an introduction to more advanced forms of editing using the command mode of .Nm ex see the editing documents written by Brian Kernighan for the editor .Xr ed 1 ; the material in the introductory and advanced documents works also with .Nm ex . .Pp .%T "An Introduction to Display Editing with Vi" introduces the display editor .Xr vi 1 and provides reference material on .Xr vi 1 . In addition, the .%T "Vi Quick Reference" card summarizes the commands of .Xr vi 1 in a useful, functional way, and is useful with the introduction. .Sh ENVIRONMENT The .Nm command uses the following environment variables. .Bl -tag -width TERMCAP .It Ev EXINIT User specified startup values for .Nm ex . .It Ev HOME Default directory to search for the file .Pa ~/.exrc .It Ev SHELL Shell used for .Em escaped commands (with the .Ic \&! command). .It Ev TERM Terminal type. .It Ev TERMCAP Alternate termcap file. .El .Sh FILES .Bl -tag -width /usr/libexec/ex?.?preserve -compact .It Pa /usr/libexec/ex?.?strings error messages .It Pa /usr/libexec/ex?.?recover recover command .It Pa /usr/libexec/ex?.?preserve preserve command .It Pa /usr/share/misc/termcap describes capabilities of terminals .It Pa ~/.exrc editor startup file .It Pa /tmp/Ex Ns Ar nnnnn editor temporary .It Pa /tmp/Rx Ns Ar nnnnn named buffer temporary .It Pa /var/preserve preservation directory .El .Sh SEE ALSO .Xr awk 1 , .Xr ed 1 , .Xr grep 1 , .Xr sed 1 , .Xr grep 1 , .Xr vi 1 , .Xr termcap 5 , .Xr environ 7 .Sh HISTORY .Nm \&Ex appeared in .Bx 3 . .Sh BUGS The .Ic undo command causes all marks to be lost on lines changed and then restored if the marked lines were changed. .Pp .Ic Undo never clears the buffer modified condition. .Pp The .Ic z command prints a number of logical rather than physical lines. More than a screen full of output may result if long lines are present. .Pp File input/output errors don't print a name if the command line .Sq Fl option is used. .Pp There is no easy way to do a single scan ignoring case. .Pp The editor does not warn if text is placed in named buffers and not used before exiting the editor. .Pp Null characters are discarded in input files, and cannot appear in resultant files.