NAME
	  ex - Edits lines in a	file interactively, with screen
	  display

     SYNOPSIS
	  ex [-lRsv] [-wnumber]	[+subcommand] [-] [file	...]

	  ex [-lRsv] [-t tag] [file ...]

	  ex -r[file] [-lRsv] [file]


	  The ex command is a line-oriented text editor	that is	a sub-
	  set of the vi	screen editor.

     FLAGS
	  -l  Indents appropriately for	LISP code, and accepts the (,
	      ), {, }, [, and ]	characters (parentheses, braces, and
	      brackets)	as text	rather than interpreting them as vi
	      subcommands.  The	LISP modifier is active	in open	or
	      visual modes.

	  -r[file]
	      Recovers file after an editor or system crash.  If you
	      do not specify file, a list of all saved files is
	      displayed.

	  -R  Sets the readonly	option,	preventing you from altering
	      the file.

	  -s  Does not display the filename or the : prompt upon
	      entering ex.  (Silent mode.)

	  -ttag
	      Loads the	file that contains tag and positions the edi-
	      tor at tag.  To use this flag, you must first create a
	      database of function names and locations using the ctags
	      command.

	  -v  Invokes the visual editor.  When the -v flag is speci-
	      fied, an enlarged	set of subcommands are available,
	      including	screen editing and cursor movement features.
	      See vi.

	  -wnumber
	      Sets the default window size to number lines.  This flag
	      is useful	only if	used with the -v flag.

	  -   Suppresses all interactive user feedback.	 If you	use
	      this flag, file input/output errors do not generate an
	      error message.

	  +subcommand
	      Begins the edit with the specified editor	search or sub-
	      command.	When subcommand	is not entered,	a + (plus
	      sign) sets the current line to the bottom	of the file.
	      Normally ex sets the current line	to the last line of
	      the file,	or to some specified tag or pattern.


     DESCRIPTION
	  The ex editor	is similar to ed, but is more powerful,	pro-
	  viding multiline displays and	access to a screen editing
	  mode.	 You may prefer	to call	vi directly to have environ-
	  ment variables set for screen	editing.  Also edit, a limited
	  subset of ex,	is available for novices or casual use.

	  The file argument specifies the file or files	to be edited.
	  If you supply	more than one file, the	ex editor edits	each
	  file in the specified	order.

	  To determine how your	tty can	perform	more efficiently, ex
	  uses the tty capability database terminfo and	the type of
	  tty you are using from the TERM environment variable.

	  The ex editor	has the	following features:


	    o  You can view text in files.  The	z subcommand lets you
	       access windows of text, and you can scroll through text
	       by pressing <Ctrl-d> and	<Ctrl-u> (visual (-v) mode
	       only).

	    o  The undo	subcommand allows you to reverse the last sub-
	       command,	even if	it is an undo subcommand.  Thus, you
	       can switch back and forth between the latest change in
	       the edit	file and the last prior	file status and	view
	       the effect of a subcommand without that effect being
	       permanent.  Commands that affect	the external environ-
	       ment cannot be undone, however.	The ex command
	       displays	changed	lines and indicates when more than a
	       few lines are affected by a subcommand.	The undo sub-
	       command causes all marks	to be lost on lines changed
	       and then	restored if the	marked lines were changed.  It
	       does not	clear the buffer modified condition.

	    o  You can retrieve	your work (except changes that were in
	       the buffer) if the system or the	editor crashes by
	       reentering the editor with the -r flag and the
	       filename.

	    o  You can edit a sequence or group	of files.  You can use
	       the next	subcommand to edit each	file on	the command
	       line in turn, or	to specify a list of filenames to edit
	       (using the shell	pattern	matching syntax).  The wild-
	       card character %	(percent sign) represents the name of
	       the current edit	file and can be	used to	form
	       filenames.

	    o  You can copy and	move text within a file	and between
	       files (see the co, d, ya, and pu	subcommands).  You use
	       a group of buffers (that	have the names of the ASCII
	       letter a	to z) to move text.  You can temporarily place
	       text in these buffers and copy or reinsert it in	a
	       file, or	you can	carry it over to another file.	The
	       buffers are cleared when	you quit the editor.  The edi-
	       tor does	not notify you if text is placed in a buffer
	       and not used before exiting the editor.

	    o  You can use patterns that match words.  A pattern can
	       be a fixed character string or a	regular	expression.

	       A regular expression is a string	constructed of special
	       pattern-matching	characters.  Using a regular expres-
	       sion to locate text in a	file gives you more flexibil-
	       ity than	trying to locate a fixed character string.
	       For more	information about regular expressions, see
	       grep.


	Editing	Modes
	  Command mode
	      When you start the ex editor, it is in command mode.
	      Enter ex subcommands at the : (colon) prompt.

	  Text entry mode
	      Entered by a, i, and c.  In this state, you can enter
	      text.  Entry state ends normally with a line that	has
	      only a . (period)	on it or ends abruptly if you press
	      the Interrupt key	sequence.

	  Visual and open mode
	      To use visual mode, use the following syntax:

	      line vi [type] [count]

	      Enters visual mode at the	specified line.	 The type
	      argument is optional, and	can be a - (dash) or . (dot),
	      as in the	z subcommand, to specify the position of the
	      specified	line on	the screen window.  (The default is to
	      place the	line at	the top	of the screen window.)	The
	      count argument specifies an initial window size; the
	      default is the value of the window option. The Q subcom-
	      mand exits visual	mode.  For more	information, see vi.

	      The o command opens a one-line window.  All three
	      commands share the input state of	the vi editor.	Press
	      <Esc> to exit text entry mode.  To return	to the ex com-
	      mand state at the	current	line, enter Q while in command
	      mode.


	The ex Limits
	  The ex editor	has the	following maximum limits:


	    o  2048 bytes per line

	    o  256 bytes per global command list

	    o  128 bytes in the	previous inserted and deleted text

	    o  128 bytes in a shell escape command

	    o  128 bytes in a string-valued option

	    o  32 bytes	in a tag name

	    o  128 map macros with 2048	bytes total


     SUBCOMMANDS
	  The ex subcommands affect the	current	line unless you
	  specify otherwise.  For information about how	to address
	  lines	in a file, see edit and	vi.

	The ex Subcommands
	  ab	 abbreviate

	  a	 append

	  ar	 display full pathname argument(s)

	  c	 change

	  cd or	chdir
		 change	directory

	  co	 copy

	  d	 delete

	  e	 edit

	  ex	 edit

	  f	 file

	  g or v global

	  i	 insert

	  j	 join

	  k	 mark

	  l	 list

	  map	 map

	  ma	 mark

	  m	 move

	  n	 next

	  nu	 number

	  o	 open

	  pre	 preserve

	  p	 print

	  pu	 put

	  q	 quit

	  re	 read

	  rec	 recover

	  rew	 rewind

	  se	 set

	  sh	 shell

	  so	 source

	  s	 substitute

	  t	 copy

	  ta	 tag

	  una	 unabbreviate

	  u	 undo

	  unm	 unmap

	  v	 global

	  ve	 version

	  vi	 visual

	  w	 write

	  x	 exit

	  ya	 yank

	  z	 window

	  =	 display addressed line	number

	  #	 display addressed lines with line numbers

		 start comment

	  !	 escape

	  <	 left shift

	  <Return>
		 display next line

	  &	 repeat	last substitute	subcommand

	  >	 right shift

	  <Ctrl-d>
		 scroll


	The ex Subcommand Addresses
	  $	 The last line

	  +	 The next line

	  -	 The previous line

	  +n	 The nth line forward

	  -n	 The nth previous line

	  %	 The first through last	lines

	  number Line number

	  .	 The current line

	  x-number
		 The numberth line before line x

	  x,y	 Lines x through y

	  'm	 The line marked with m

	  ''	 The previous context

	  /pattern$
		 The next line with pattern at end of line

	  /^pattern
		 The next line with pattern at start of	line

	  /pattern
		 The next line with pattern

	  ?pattern
		 The previous line with	pattern


	Scanning Pattern Formation
	  ^	 The beginning of the line

	  $	 The end of the	line

	  .	 Any character

	  \<	 The beginning of the word

	  \>	 The end of the	word

	  [string]
		 Any character in string

	  [^string]
		 Any character not in string

	  [x-y]	 Any character between x and y,	inclusive

	  *	 Any number of the preceding character

	  ~	 The replacement part of the last substitute command.

	  /(pattern\)
		 A regular expression pattern can be enclosed in
		 escaped parentheses to	identify them for substitution
		 actions.

     FILES
	  /usr/lbin/exrecover
			The recover subcommand.

	  /usr/lbin/expreserve
			The preserve subcommand.

	  /usr/share/lib/terminfo/?/*
			Terminal information database.

	  .exrc	or $HOME/.exrc
			Editor start-up	file.

	  /tmp/Exnnnnn	Editor temporary file.

	  /tmp/Rxnnnnn	Names buffer temporary file.

	  /var/preserve	Preservation directory.


     RELATED INFORMATION
	  Commands:  ctags(1), ed(1)/red(1), edit(1),
	  grep(1)/egrep(1)/fgrep(1), vi(1)/vedit(1)/view(1).

	  Files:  terminfo(4).

	  The TERM environment variable.

























Acknowledgement and Disclaimer