.\" Copyright (c) 1980, 1990 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms are permitted provided .\" that: (1) source distributions retain this entire copyright notice and .\" comment, and (2) distributions including binaries display the following .\" acknowledgement: ``This product includes software developed by the .\" University of California, Berkeley and its contributors'' in the .\" documentation or other materials provided with the distribution and in .\" all advertising materials mentioning features or use of this software. .\" 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" .\" @(#)ex.1 6.6 (Berkeley) 7/24/90 .\" .Dd July 24, 1990 .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 + Ar command .Oo .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 . .Pp If you have not used .Xr ed 1 , or are a casual user, you will find that the editor .Nm edit is convenient for you. It avoids some of the complexities of .Nm ex used mostly by systems programmers and persons very familiar with .Xr ed 1 . .Pp If you have a .Li CRT terminal, you may wish to use a display based editor; in this case see .Xr vi 1 , which is a command which focuses on the display editing portion of .Nm ex . .Sh DOCUMENTATION The document .Em Edit: A tutorial (USD:14) provides a comprehensive introduction to .Nm edit assuming no previous knowledge of computers or the UNIX system. .Pp The .Em Ex Reference Manual \- Version 3.7 (USD:16) 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 .Em An Introduction to Display Editing with Vi (USD:15) introduces the display editor .Xr vi 1 and provides reference material on .Xr vi 1 . In addition, the .Em Vi Quick Reference card summarizes the commands of .Xr vi 1 in a useful, functional way, and is useful with the .Em Introduction . .Sh ENVIRONMENT The .Nm command uses the following environment variables. .Tw Fl .Tp Ev EXINIT User specified startup values for .Nm ex . .Tp Ev HOME Default directory to search for the file .Pa ~/.exrc .Tp Ev SHELL Shell used for .Em escaped commands (with the .Ic \&! command). .Tp Ev TERM Terminal type. .Tp Ev TERMCAP Alternate termcap file. .Tp .Sh FILES .Dw /usr/libexec/ex?.?preserve .Di L .Dp Pa /usr/libexec/ex?.?strings error messages .Dp Pa /usr/libexec/ex?.?recover recover command .Dp Pa /usr/libexec/ex?.?preserve preserve command .Dp Pa /usr/share/misc/termcap describes capabilities of terminals .Dp Pa ~/.exrc editor startup file .Dc Pa /tmp/Ex .Ar nnnnn .Cx editor temporary .Dc Pa /tmp/Rx .Ar nnnnn .Cx named buffer temporary .Dp Pa /var/preserve preservation directory .Dp .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 3 BSD. .Sh AUTHOR Originally written by William Joy .br Mark Horton has maintained the editor since version 2.7, adding macros, support for many unusual terminals, and other features such as word abbreviation mode. .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.