ex.1 (2010 09)

e
ex(1) ex(1)
-x Set encryption mode. You are prompted for a key to initiate the creation or editing of an
encrypted file (see the crypt command in Command Descriptions below).
-C Encryption option. Same as the -x
option, except that all text read in is assumed to have
been encrypted.
-c command (UNIX Standard only, see standards (5))
+command (Obsolescent) Begin editing by executing the specified
ex search or positioning command.
file Specify the file or files to be edited. If more than one file is specified, they are processed
in the order given. If the
-r option is also specified, the files are read from the recovery
area.
(UNIX Standard only, see standards (5)) If both the
-t tag and -c command options are given, the -t
tag shall be processed first;i.e, the file containing the tag is selected by the
-t and then the command is
executed.
Definitions
Current file. The name of the file being edited by
ex is called the current file. Text from the current file
is read into a work area, and all editing changes are performed on this work area. Changes do not affect
the original file until the work area is explicitly written back to the file. If the
% character is used as a
file name, it is replaced by the current file name.
Alternate file. The alternate file is the name of the last file mentioned in an editor command, or the
previous current file name if the last file mentioned becomes the current file. If the
# character is used as
a file name, it is replaced by the alternate file name.
Buffers. Twenty-six buffers named
a through z can be used for saving blocks of text during the edit. If
the buffer name is specified in uppercase, text is appended to the existing buffer contents rather than
overwriting it.
Readonly ag. The
readonly flag can be cleared from within the editor by setting the
noreadonly
editor option (see Editor Options below). Writing to a different file is allowed even when the
readonly
flag is set. Also, a write can be forced to a readonly file by using
! after the write command (see the
write command in Command Descriptions below).
Interrupt. If an interrupt signal is received, and commands are being supplied from a keyboard,
ex
returns to command mode. If editor commands are coming from a file, an interrupt signal causes
ex to
abort.
System crash. If the system crashes or
ex aborts due to an internal error or unexpected signal,
ex
attempts to preserve the work area if any unwritten changes were made. Use the -r command-line
option to retrieve the saved changes.
Command mode/input mode.
ex starts up in command mode, as indicated by the colon (:
)prompt.
ex switches to input mode whenever an append, change,orinsert command is encountered. To ter-
minate input mode and return to command mode, type a period (.) alone at the beginning of a line.
Comments. Command lines beginning with a quotation mark (
") are ignored (this is useful for placing
comments in an editor script).
Multiple commands can be combined on a single line by separating them with a vertical bar character
(
|). However, global commands, comments, and the shell escape command must be the last command on
a line because they cannot be terminated by a | character.
Addressing
(UNIX Standard only, see standards (5)) Addressing in
ex relates to the current line. In general, the
current line shall be the last line affected by the command; the exact effect on the current line is discussed
under the description of each command. When the buffer contains no lines, the current line shall be set to
zero.
ex recognizes the following line address forms:
. Dot or period (.) refers to the current line. There is always a current line whose
position can be the result of an explicit movement command or the result of a com-
mand that affects multiple lines (in which case it is usually the last line affected).
n The nth line in the work area. Lines are numbered sequentially, starting at line 1.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010