ex(1)									ex(1)



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

SYNOPSIS

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

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

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

FLAGS

  -c subcommand
      Executes the specified ex subcommand (command) before displaying the
      file for which the editor was invoked.

  -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 editor 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 specified, an enlarged
      set of subcommands is available, including screen editing and cursor
      movement features.  See vi.

  -wnumber
      Sets the default window size to number lines.

  -   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 subcommand.  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 command is a line-oriented text editor that is a subset of the vi
  screen editor.  (The e command is a synonym for ex.)


  The ex editor is similar to ed, but is more powerful, providing multiline
  displays and access to a screen editing mode.	 You may prefer to call vi
  directly to have environment 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 terminal can perform more efficiently, ex uses the
  terminal capability database terminfo and the type of terminal you are
  using from the TERM environment variable.

  The ex editor has the following features:

    +  The z subcommand lets you access windows of text, and you can scroll
       through text by pressing  and  (visual (-v) mode
       only).

    +  The undo subcommand allows you to reverse the last subcommand, 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 environment cannot be undone, how-
       ever.  The ex command displays changed lines and indicates when more
       than a few lines are affected by a subcommand.  The undo subcommand
       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 con-
       dition. 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 file name.

    +  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
       file names to edit (using the shell pattern matching syntax).  The
       wildcard character % (percent sign) represents the name of the current
       edit file and can be used to form file names.

    +  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 editor does not notify you if text is placed in a
       buffer and not used before exiting the editor.

    +  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 expression to locate text in a
       file gives you more flexibility than trying to locate a fixed charac-
       ter 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.  Pressing  cancels a partial
      subcommand.

  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
      Entered by vi, vi., vi-, or o.  Each of the first three commands gives
      you a full screen vi editor, but puts the current line in a different
      place on entry.  Enter vi to put the current line at the top of the
      screen; enter vi. to put the current line in the middle of the screen;
      and enter vi- to put the current line at the bottom of the screen.

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

  Limits of ex

  The ex editor has the following maximum limits:

    +  2048 bytes per line

    +  256 bytes per global command list

    +  128 bytes in the previous inserted and deleted text

    +  128 bytes in a shell escape command

    +  128 bytes in a string-valued option

    +  30 bytes in a tag name

    +  128 map macros with 2048 bytes total

  Subcommands


       The ex subcommands affect the current line unless you specify other-
       wise.  For information about how to address lines in a file, see edit
       and vi.	For a complete description of edit options, see Setting
       Options on the vi reference page.

  ab[brev] word abbrev
      Adds the specified abbreviation to the current abbreviation list.

  [line] a[ppend][!]
      Enters input mode and places text after the specified line.  To place
      the text at the beginning of the buffer, specify line 0.	The ! (excla-
      mation point) toggles the autoindent editor option setting for the exe-
      cution of this subcommand.

  ar[gs]
      Writes the argument list (the list of arguments on startup) with the
      current argument inside [ and ] (left and right brackets).  The argu-
      ment list can later be replaced by the arguments of the next subcom-
      mand.

  [range] c[hange][!] [count]
      Enters input mode and replaces the lines in range with the input text.
      The current line is the last line input.	The ! (exclamation point),
      toggles the autoindent editor option setting for the execution of this
      subcommand.

  chd[ir][!] [directory]

  cd[!] [directory]
      Changes the current working directory to directory.  If the current
      buffer has been modified since the last write, the subcommand issues a
      warning and fails.  You can override this warning by appending a !
      (exclamation point) to the subcommand name.

  [range] co[py] line [flags]

  [range] t line [flags]
      Places a copy of the lines in range after the specified line.  Line 0
      causes the lines to be placed at the beginning of the buffer.

  [range] d[elete] [buffer] [count] [flags]
      Deletes the specified lines from the buffer.  If you specify a named
      buffer, the deleted text is placed there; otherwise, the deleted text
      is placed in the unnamed buffer.	The current line is the line follow-
      ing the deleted lines, or the last line if the deleted lines were at
      the end.

  e[dit][!] [+line] [file]

  ex[!] [+line] [file]
      Edits file.  If the current buffer has been modified since the last
      write, the subcommand writes a warning and terminates.  You can over-
      ride this action by appending the ! (exclamation point) character to
      the subcommand (for example, e! file).

      If the +line argument is specified, the current line is the specified
      position, where line can be a number (or $) or can be specified as
      /pattern or ?pattern.  Preceding the pattern with a / (slash) starts a
      search from the beginning of the file.  Preceding the pattern with a ?
      (question mark) starts a search from the end of the file.	 This subcom-
      mand is affected by the autowrite and writeany editor options.

  f[ile] [file]
      Writes the current pathname, the number of lines, and the current posi-
      tion (if no file argument was specified).	 If file is specified, ex
      changes the current filename to file without changing the contents of
      the buffer or the previous current file.

  [range] g[lobal] /pattern/ [subcommands]

  [range] v /pattern/ [subcommands]
      Marks the lines within the given range that match (g) or do not match
      (v) the given pattern.  Then executes the ex subcommands with the
      current line set to each marked line.

      You can specify multiple subcommands, one per line, by escaping each
      newline character with a \ (backslash).  If the subcommands argument is
      not specified, each line is written.  For the append, change, and
      insert subcommands, the input text is included as part of the global
      subcommand; in this case, you can omit the terminating period if it
      ends subcommands.	 The visual subcommand can be specified as part of
      subcommands.  In this mode, input is taken from the terminal.  Entering
      a Q from visual mode selects the next line matching the pattern and
      re-enters visual mode, until the list is exhausted.

      You cannot use the global subcommand itself and the undo subcommand in
      the subcommands argument.	 The autoprint, autoindent, and report editor
      options are inhibited for the duration of the g or v subcommand.

  [line] i[nsert][!]
      Enters input mode and places the input text before the specified line.
      The ! (exclamation point) toggles the autoindent editor option setting
      for the execution of this subcommand.

  [range] j[oin][!] [count] [flags]
      Joins the text from the specified lines together into one line.  In the
      POSIX locale, when the last character on the first line of a pair of
      lines to be joined is a . (period), two spaces are added following the
      period; when the last character of the first line is a space or when
      the first character on the second line of the pair is a ) (right
      parenthesis), no spaces are added; otherwise, one space is added fol-
      lowing the last character of the first line.  Extra spaces at the start
      of a line are discarded.

      Appending a ! (exclamation point) character to the join subcommand
      causes a simpler join with no whitespace processing, independent of the
      current locale.

  [range] l[ist] [count] [flags]
      Writes the addressed lines; nonprintable characters are written as mul-
      ticharacter sequences.  The end of the line is marked with a $ (dollar
      sign).

      Long lines are folded.  The current line is the last line written.

  map[!] [x rhs]
      Defines macros for use in visual mode.  The first argument must be a
      single character or the sequence #digit (one of the terminal's numbered
      function keys).  When this character or function key is entered in
      visual mode, the action is as if the corresponding rhs had been
      entered.	If the ! (exclamation point) character is appended to the
      subcommand name map, the mapping is effective during input mode rather
      than command mode.  This allows x to have two different macro defini-
      tions at the same time: one for command mode and one for input mode.
      Nonprintable characters, except for the Tab character, require escaping
      with  (or ) to be entered in the arguments.  On certain
      block mode terminals, the mapping need not occur immediately (for exam-
      ple, it might occur after the terminal transmits a group of characters
      to the system), but it modifies the file as if it occurred immediately.

      The map subcommand with no arguments writes all of the macros currently
      defined.	If ! (exclamation point) is appended to the subcommand, only
      the macros effective during input mode are written; otherwise, only the
      macros effective during command mode are written.

  [line] ma[rk] x

  [line] k x
      Gives the specified line the specified mark x, which must be a single
      lowercase letter of the POSIX locale.  The current line position is not
      affected.	 The expression 'x can then be used as an address in any sub-
      command requiring one.  For example, the following subcommand deletes
      all of the lines from the current one to the marked line:
	    .,'xd
      In addition, see the vi `` and '' subcommands for uses of the mark in
      visual mode.  If the 'x subcommand is used in nonvisual mode, the char-
      acter marked is the first nonspace character of the current line; oth-
      erwise, the character marked is the character at the current column of
      the current line.

  [range] m[ove] line
      Moves the specified lines (range) after the target line (line).  The
      current line is the first of the moved lines.

  n[ext][!] [file ...]
      Edits the next file from the argument list.  If the current buffer has
      been modified since the last write, the subcommand writes a warning and
      terminates.  You can override this action by appending the ! (exclama-
      tion point) character to the subcommand name (n!).  You can replace the
      argument list by specifying a new one as arguments to this subcommand.
      Editing then starts with the first file on this new list.	 The current
      line is reset as described for the edit subcommand.  This subcommand is
      affected by the autowrite and writeany editor options.

  [range] nu[mber] [count] [flags]

  [range] # [count] [flags]
      Writes the selected lines, each preceded with its line number in
      decimal.	Nonprintable characters, except for , are expanded as
      specified by the print subcommand.

      The only meaningful flag is l, which allows additional expanded writing
      of tabs and End-of-Line characters by the list subcommand.  The current
      line is the last line written.

  [line] o[pen] /pattern/ [flags]
      Enters open mode, which is equivalent to visual mode with a one-line
      window.  All visual mode subcommands are available.  If a match is
      found for the optional regular expression in line, the cursor is placed
      at the start of the matching pattern.  The visual mode subcommand Q
      (see vi) exits open mode.

  pre[serve]
      Saves the current buffer in a form that can later be recovered by using
      ex -r or by using the recover subcommand.	 After the file has been
      preserved, a mail message is sent to the user.  The message contains
      the name of the file, the time of preservation, and an ex subcommand
      for recovering the file.	Additional information can be included in the
      mail message.

  [range] p[rint] [count] [flags]
      Writes the addressed lines.  Nonprintable characters, except for the
      Tab character, are written as multicharacter sequences.  Long lines are
      folded.  The only meaningful flags are # and l.  The current line is
      the last line written.

  [line] pu[t] [buffer]
      Puts back deleted or yanked lines after the specified line.  A buffer
      can be specified; otherwise, the text in the unnamed buffer (where
      deleted or yanked text is placed by default) is restored.	 The current
      line is the first line put back.

  q[uit][!]
      Terminates the editing session.  If the current buffer has been modi-
      fied since the last write, the subcommand writes a warning and ter-
      minates.	You can override this warning and force an exit, discarding
      changes, by appending the character ! to the subcommand name.

  [line] r[ead][!] [file]
      Places a copy of the specified file in the current buffer after the
      target line (line 0 places text at the beginning).  If no file is
      named, the current file is the default.  If there is no current file,
      the specified file becomes the current file.  If there is neither
      current file nor file argument, the subcommand fails.

      The current line is the last line read.  In visual mode, the current
      line is the first line read.  If file is preceded by !, file is taken
      to be an operating system command and passed to the program named in
      the SHELL environment variable.  The resulting output is read in to the
      buffer.  You can override the special meaning of ! by escaping it with
      a \ (backslash) character.

  rec[over] file
      Attempts to recover file if it was saved as the result of a preserve
      subcommand, the receipt of a signal, or a system or editor crash.	 The
      current line is reset as described for the read subcommand.

  rew[ind][!]
      Rewinds the argument list; that is, sets the current file to the first
      file in the argument list.  This is equivalent to a next subcommand
      with the current argument list as its argument.  If the current buffer
      has been modified since the last write, the subcommand writes a warning
      and terminates.  You can override the action by appending the ! (excla-
      mation point) character to the subcommand name (rew!).  The current
      line is reset as described for the read editor subcommand.  This sub-
      command is affected by the autowrite and writeany editor options.

  se[t] [option[=[value]] ...  [nooption ...] [option? ...] [all]
      When no arguments are specified, writes those options whose values have
      been changed from the default settings; when the argument all is speci-
      fied, writes all of the option values.

      Specifying an option name followed by the ? character causes the
      current value of that option to be written.  The ? can be separated
      from the option name by zero or more spaces.  The ? is necessary only
      for Boolean valued options.  Boolean options can be given values by the
      form se option to turn them on or se nooption to turn them off; string
      and numeric options can be assigned by the form se option=value.
      Spaces in strings can be included as they are by preceding each such
      character with a \ (backslash).  More than one option can be set or
      listed by a single set subcommand by specifying multiple arguments,
      each separated from the next by one or more spaces.

  sh[ell]
      Invokes the program named in the SHELL environment variable with the
      argument -i (interactive mode).  You can resume editing when the pro-
      gram exits.

  so[urce] file
      Reads and executes subcommands from the file specified by the mandatory
      file argument.  Such source subcommands can be nested.

  [range] s[ubstitute] [/pattern/repl/[options] [count] [flags]
      Replaces the first instance of pattern by the string repl on each
      specified line.  If the /pattern/repl/ argument is not present, the
      /pattern/repl/ from the previous substitute subcommand is used.

      If options includes the letter g (global), all nonoverlapping instances
      of the pattern in the line are substituted.  If the option letter c
      (confirm) is included, then before each substitution the line is writ-
      ten with ^ characters written on the following line, adjacent to and
      identifying the pattern to be replaced; an affirmative response causes
      the substitution to be done, while any other input causes it to abort.
      An affirmative response consists of a line with the affirmative
      response (as defined by the current locale) at the beginning of the
      line.  Such a line is subject to editing in the same way as the command
      line (the / or : line at the bottom of the screen).

      The current line is the last line substituted.  When the c option is
      used, typing the Interrupt character or receiving the SIGINT signal
      stops the substitute operation, and ex returns to command mode.  All
      substitutions completed before the interrupt occurred are retained and
      none are made after that point.  The current line is the last line sub-
      stituted.

      This subcommand is affected by the LC_MESSAGES environment variable and
      the wrapscan option.

  su[spend][!]

  st[op][!]
      Allows control to return to the invoking process; ex suspends itself as
      if it had received the SIGTSTP signal.  The suspension occurs only if
      job control is enabled in the invoking shell.

      Following either suspend or stop with the character ! affects the
      operation of the autowrite editor option for this subcommand only.

      The current suspend character (see stty) also causes the suspension.

  ta[g][!] tagstring
      Searches for the tag string, which can be in a different file.  If the
      tag is in a different file, the new file is opened for editing.  If the
      current buffer has been modified since the last write, the subcommand
      writes a warning and terminates.	You can override the action by
      appending the ! character to the subcommand name.	 The current line is
      reset to the line indicated by the tag.  This subcommand is affected by
      the autowrite, tags, and writeany editor options.

      The tag subcommand searches for tagstring in the tag file referred to
      by the tags editor option until a reference to tagstring is found.  The
      file pointed to by this reference is loaded into the buffer, and the
      current line is set to the first occurrence of the pattern specified in
      the tags file associated with the supplied tagstring.  If the tags file
      contained a line number reference, the current line is set to that
      line.  If the pattern or line number is not found, the subcommand
      writes an error message.	If a file referred to by the tags editor
      option does not exist or is not readable, the subcommand also writes an
      error message.

  una[bbrev] word
      Deletes word from the list of abbreviations, as described by the abbrev
      subcommand.

  u[ndo]
      Reverses the changes made by the previous editing subcommand (one that
      changes the contents of the buffer).  For this purpose, global and
      visual are considered single subcommands.	 An undo can itself be
      reversed.	 Commands that affect the external environment, such as
      write, edit, and next cannot be undone.

  unm[ap][!] x
      If no ! (exclamation point) is specified, removes the command-mode
      macro definition for x; otherwise, removes the input-mode macro defini-
      tion for x.  See the map subcommand.

  [line] vi[sual] [type] [count] [flags]
      Enters visual mode with the current line set to line.  The type argu-
      ment is optional, and can be a - (minus sign), . (period), + (plus
      sign), or ^ (circumflex), as in the z subcommand, to specify the posi-
      tion 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 the number of lines that are initially written; the default
      is the value of the window editor option.	 The Q subcommand exits
      visual mode.  (For more information about the Q subcommand, see the vi
      reference page.)

  [range] w[rite][!] [>>] [file]

  [range] w[rite] [!] [file]

  [range] wq[!] [>>] [file]
      Writes the specified lines (the whole buffer, if range is not speci-
      fied) out to the file represented by pathname file, writing to standard
      output the number of lines and bytes written.

      If file is specified and is not the current file, and the file named by
      file exists, then the write fails.  If the current file has been
      changed by the file subcommand and that file exists, the write fails.
      In either case, you can force the write by appending the ! (exclamation
      point) character to the subcommand name.	You can append to an existing
      file by appending >> to the subcommand name.

      If the file argument is preceded by a ! (exclamation point) character,
      the program named in the SHELL environment variable is invoked with
      file as its second argument, and the specified lines are passed as
      standard input to the subcommand.	 The ! in this usage must be
      separated from the write subcommand by at least one space character.
      You can override the special meaning of ! by escaping it with a \
      (backslash) character.  This subcommand is affected by the writeany and
      readonly editor options.

      The subcommand wq is equivalent to a w followed by a q; wq! is
      equivalent to w! followed by q.  If the current buffer has no pathname
      associated with it, the write subcommand fails.

  [range] x[it][!] [file]
      Performs a write subcommand if any changes have been made to the
      current buffer since the last write to any file.

      Unless the subcommand fails because an attempt to write lines to a file
      did not succeed, the ex program exits after an x subcommand.  This sub-
      command is affected by the writeany and readonly editor options.

  [range] ya[nk] [buffer] [count]
      Places the specified lines in the named buffer.  If no buffer is speci-
      fied, the unnamed buffer is used (where the most recently deleted or
      yanked text is placed by default).

  [line] z [type] [count] [flags]
      If type is omitted, count lines following the specified line are writ-
      ten.  The default for count is the value of the window editor option.
      The type argument changes the position where line is written on the
      screen by affecting the number of lines written before and after line.

      If type is specified, it is one of the following:

      - (dash)
	  Places line at the bottom of the screen.

      + (plus sign)
	  Places line at the top of the screen.

      . (period)
	  Places line in the middle.

      ^ (circumflex)
	  Writes out count lines starting count*2 lines before the addressed
	  line; the net effect of this is that a z^ subcommand following
	  another z subcommand writes the previous page.

      = (equal sign)
	  Centers the addressed line on the screen with a line of - (dash)
	  characters written immediately before and after it.  The number of
	  preceding and following lines of text written are reduced to
	  account for these lines of hyphens.

      In all cases, the current line is the last line written, with the
      exception of the = type, which causes the current line to be that
      addressed in the subcommand.

  ! subcommand

  [range]! subcommand
      Passes the remainder of the line after the ! (exclamation point) char-
      acter to the program named in the SHELL environment variable for execu-
      tion.  A warning is issued if the buffer has been changed since the
      last write.  A single ! character is written when the subcommand com-
      pletes.  The current line position is not affected.

      Within the text of subcommand, % (percent sign) and # (number sign) are
      expanded as pathnames (the current and alternative pathnames, respec-
      tively), and ! is replaced with the text of the previous ! subcommand.
      (Thus, !! repeats the previous ! subcommand.)  If any such expansion is
      performed, the expanded line is echoed.

      You can override the special meanings of %, #, and ! by escaping them
      with a \ (backslash) character.  This subcommand is affected by the
      autowrite and writeany editor options.

      In the second form of the ! subcommand, the remainder of the line after
      the ! is passed to the program named in the SHELL environment variable,
      as described previously.	The specified lines are provided to the pro-
      gram as standard input; the resulting output replaces the specified
      lines.

  [range] < [count] [flags]
      Shifts the specified lines to the left; the number of character posi-
      tions to be shifted is determined by the shiftwidth editor option.
      Only leading spaces are lost in shifting; other characters are not
      affected.	 The current line is the last line changed.

  [range] > [count] [flags]
      Shifts the specified lines to the right, by inserting spaces, using
      tabs where possible, as determined by the shiftwidth editor option.
      Empty lines are not changed.  The current line is the last line
      changed.

  [range] & [options] [count] [flags]

  [range] s[ubstitute] [options] [count] [flags]

  [range] ~ [options] [count] [flags]
      Repeats the previous substitute subcommand, as if (&) were replaced by
      the previous s/pattern/repl/ subcommand.	(The same effect can be
      obtained by omitting the /pattern/repl/ string in the substitute sub-
      command.)	 The version of the subcommand using ~ (tilde) is the same as
      & and s, but the pattern used is the last regular expression used in
      any subcommand, not necessarily the one used in the last substitute
      subcommand.  For example, in the following sequence, the ~ (tilde) is
      equivalent to s/green/blue/:
	   s/red/blue/
	   /green
	   ~

  [line] = [flags]
      Writes the line number of the specified line (the default is the last
      line).  The current line position is not affected.

  
      Writes the next n lines, where n is the value of the editor option
      scroll.  The subcommand is invoked with the End-of-File character.  The
      current line is the last line written.

  @ buffer

  * buffer
      Executes each line of the named buffer as an ex subcommand.  If no
      buffer is specified, or is specified as @ or *, the last buffer exe-
      cuted is used.  If there is no last buffer, an error occurs.

  #   Displays addressed lines with line numbers

  "   Starts comment

  
      Displays next line

  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 subcommand.

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

  Startup Files

  When you customize ex from the ex command line, the customized editor is in
  effect until you exit the editor. If you want to reuse such things as
  option settings and key mappings, you must put them in the .exrc file in
  your home directory or define the EXINIT environment variable.  The ex edi-
  tor processes the commands given in the EXINIT variable or reads the .exrc
  file each time you invoke it. Here is an example of an .exrc file:

       set ai aw
       set wm=5

  Users with both a .exrc file and an EXINIT environment variable will find
  that the ex editor no longer reads the .exrc file. This change was made to
  meet the specifications of XPG4.

  The standard provides for an approximation of the old behavior. A new vari-
  able, named exrc, is defined.	 When this variable is set by the commands in
  the EXINIT environment variable, the editor reads .exrc in the current
  directory for additional startup commands.  For example:

       setenv EXINIT 'set ai terse magic bf wm=1 exrc'

  Additionally, the editor refuses to read the .exrc file if its mode grants
  write permission to anyone other than the owner; this restriction prevents
  certain security breaches.  No overt indication is given when such a
  refusal occurs.

FILES

  /usr/lbin/exrecover recover subcommand

  /usr/lbin/expreserve
		      preserve subcommand

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

  ./.exrc or $HOME/.exrc
		      Editor startup 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.