1.\" Copyright (c) 1980, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)ex.1 6.5 (Berkeley) 06/24/90 7.\" 8.Dd 9.Dt EX 1 10.Os BSD 4 11.Sh NAME 12.Nm ex , edit 13.Nd text editor 14.Sh SYNOPSIS 15.Nm ex 16.Op Fl 17.Op Fl v 18.Op Fl t Ar tag 19.Op Fl r 20.Oo 21.Op Cm + Ar command 22.Oo 23.Op Fl l 24.Ar name 25\&... 26.Nm edit 27.Op ex options 28.Sh DESCRIPTION 29.Nm Ex 30is the root of a family of editors: 31.Nm edit , 32.Nm ex 33and 34.Nm vi . 35.Nm Ex 36is a superset of 37.Xr ed , 38with the most notable extension being a display editing facility. 39Display based editing is the focus of 40.Xr vi 1 . 41.Pp 42If you have not used 43.Xr ed 1 , 44or are a casual user, you will find that the editor 45.Nm edit 46is convenient for you. 47It avoids some of the complexities of 48.Nm ex 49used mostly by systems programmers and persons very familiar with 50.Xr ed 1 . 51.Pp 52If you have a 53.Li CRT 54terminal, you may wish to use a display 55based editor; in this case 56see 57.Xr vi 1 , 58which is a command which focuses on the display editing portion of 59.Nm ex . 60.Sh DOCUMENTATION 61The document 62.Em Edit: A tutorial 63(USD:14) provides a comprehensive introduction to 64.Nm edit 65assuming no previous knowledge of computers or the UNIX 66system. 67.Pp 68The 69.Em Ex Reference Manual \- Version 3.7 70(USD:16) 71is a comprehensive and complete manual for the command mode features 72of 73.Nm ex , 74but you cannot learn to use the editor by reading it. 75For an introduction to 76more advanced forms of editing using the command mode of 77.Nm ex 78see the editing documents written by Brian Kernighan for the editor 79.Xr ed 1 ; 80the material in the introductory and advanced documents works also with 81.Nm ex . 82.Pp 83.Em An Introduction to Display Editing with Vi 84(USD:15) 85introduces the display editor 86.Xr vi 1 87and provides reference material on 88.Xr vi 1 . 89In addition, the 90.Em Vi Quick Reference 91card summarizes the commands 92of 93.Xr vi 1 94in a useful, functional way, and is useful with the 95.Em Introduction . 96.Sh ENVIRONMENT 97The 98.Nm 99command uses the following environment variables. 100.Tw Ar 101.Tp Ev EXINIT 102User specified startup values for 103.Nm ex . 104.Tp Ev HOME 105Default directory to search for 106the file 107.Pa ~/.exrc 108.Tp Ev SHELL 109Shell used for 110.Em escaped 111commands (with the 112.Ic \&! 113command). 114.Tp Ev TERM 115Terminal type. 116.Tp Ev TERMCAP 117Alternate termcap file. 118.Tp 119.Sh FILES 120.Dw /usr/libexec/ex?.?preserve 121.Di L 122.Dp Pa /usr/libexec/ex?.?strings 123error messages 124.Dp Pa /usr/libexec/ex?.?recover 125recover command 126.Dp Pa /usr/libexec/ex?.?preserve 127preserve command 128.Dp Pa /usr/share/misc/termcap 129describes capabilities of terminals 130.Dp Pa ~/.exrc 131editor startup file 132.Dc Pa /tmp/Ex 133.Ar nnnnn 134.Cx 135editor temporary 136.Dc Pa /tmp/Rx 137.Ar nnnnn 138.Cx 139named buffer temporary 140.Dp Pa /var/preserve 141preservation directory 142.Dp 143.Sh SEE ALSO 144.Xr awk 1 , 145.Xr ed 1 , 146.Xr grep 1 , 147.Xr sed 1 , 148.Xr grep 1 , 149.Xr vi 1 , 150.Xr termcap 5 , 151.Xr environ 7 152.Sh HISTORY 153.Nm Ex 154appeared in 3 BSD. 155.Sh AUTHOR 156Originally written by William Joy 157.br 158Mark Horton has maintained the editor since version 2.7, adding macros, 159support for many unusual terminals, 160and other features such as word abbreviation mode. 161.Sh BUGS 162The 163.Ic undo 164command causes all marks to be lost on lines changed and then restored 165if the marked lines were changed. 166.Pp 167.Ic Undo 168never clears the buffer modified condition. 169.Pp 170The 171.Ic z 172command prints a number of logical rather than physical lines. 173More than a screen full of output may result if long lines are present. 174.Pp 175File input/output errors don't print a name if the command line 176.Sq Fl 177option is used. 178.Pp 179There is no easy way to do a single scan ignoring case. 180.Pp 181The editor does not warn if text is placed in named buffers and not used 182before exiting the editor. 183.Pp 184Null characters are discarded in input files, and cannot appear in resultant 185files. 186