Module 43 ex

Previous Table of Contents Next


Module 43
ex

DESCRIPTION

The external ex command is a powerful line editor that forms the base of the vi editor. It is a supet-set of the original UNIX line editor ed . The basic line editing commands, macros, abbreviations, tags, substitutions, options, the EXINIT variable, and the .exrc file are discussed in this module. The visually oriented aspects of ex / vi are discussed in Module 151.

COMMAND FORMAT

Following is the general format of the ex command.

 ex [ -CRLsvx ] [ -r lost ] [ -t tag ] [ -c cmd ] [ file ] 

BSD (Berkeley)
ex [ - ] [ -lv ] [ -r lost ] [ -t tag ] [ +cmd ] [ file ]

Options

The following list describes the options and their arguments that may be used to control how ex functions.

-C Same as -x below except all text read into the buffer is assumed to be encrypted, unless a null key is specified.
-R Read-only mode; no updates allowed.
-L List the names of all files saved when the system crashed or the editor aborted.
-c cmd Display buffer after interpreting an ex command cmd. Enclose commands with special characters in single quotes ( cmd ) to escape shell interpretation.
-r [ lost ] Recover lost file that was preserved during abnormal termination of ex / vi . Use -r option alone for list of preserved files.
-s Suppress all standard output (interactive feedback). Used for batch editor script processing.
-t tag Starting at tag , edit the file that is referenced by tag in the tags file.
-x Edit encrypted files. You are prompted for an encryption key.
-v Invoke vi .

BSD (Berkeley)
- Same as System V -s option.
-l Sets the showmatch and lisp mode options. The ( ), { }, [ [ and ] ] commands are changed to indent for lisp code.
+ cmd Same as System V -c cmd. Plus (+) with no cmd begins editing at last line of buffer.

Arguments

The following argument may be passed to the ex command.

file_list One or more files to edit. If you specify more than one file, ex edits the first file on the command line. To edit the next file, you enter :n and press Return.

Table of Contents

The following is a brief table of contents that will help you locate information in this module.

FUNCTIONAL OVERVIEW
ACCESS TO VI
vi Mode
ADDRESSING
Basic Addressing
Address Ranges
SPECIAL ex CHARACTERS
COMMANDS
Command Format
Displaying Text
Window Sizing
Inserting Text
Changing Text
Copying Text
Deleting Text
Marking Positions
Moving Text
Moving Text (cut & paste)
Yanking (cutting)
Putting (pasting)
Moving text between files
Indenting Text
Filtering Text
Join Lines
Undo, Redo, and Retrieve
Edit/Re-edit a File
Edit/Re-edit Multiple Files
Read from a File
Write to a File
Escape to Unix
Searches
Global Searches
Global Exception Search
Substitutions
Substitute Options
REGULAR EXPRESSIONS
Metacharacters
Special Substitute Characters
TAGS
Tag File Format
Referencing a Tag
MACROS
MISCELLANEOUS
LEAVING ex
CUSTOMIZING OPTIONS
The Options
The .exrc File
The EXINIT Variable

FUNCTIONAL OVERVIEW

The ex editor is a line editor. Most of the commands are line oriented. Thus to perform character changes and deletions you have to use the substitute command or open mode. Open mode is visual editing on one line of text. You may find these methods to be tedious and not very productive, which is why vi exists.

It is also necessary to provide unique amounts of each command s name . This causes the names in ex to have more meaning than the single keystrokes used in vi but may cause some confusion between the two editors. A suggestion is to utilize vi for all character and line oriented editing and the moving of text with operators. While using ex to perform file operations, substitutions, setting macros, setting abbreviations, and tags. Obviously, there is overlapping of functions but in general, ex supplies a gateway to administrative commands used while in vi .


NOTE:    
Each command in ex command mode must be followed by a Return. When you are in vi command mode, the characters are interpreted as they are typed and no Return is needed in most cases.

Interface capabilities

The ex editor can interface with vi mode to provide full-screen editing. It has the ability to interface to the UNIX system. A subshell may be entered from ex and UNIX WP NYcommands executed until a Ctrl-D or exit is entered. UNIX commands can be executed from ex without leaving the editor. The vi mode can interface with UNIX filters to allow for special editing capabilities.

ACCESS TO VI

You can move between the ex and vi editors with simple commands. The vi editor is the visual extension of the ex editor. To access vi from ex you simply type vi at the colon prompt. You must have your TERM variable set correctly for vi to function properly. ex also requires limited knowledge of your terminal type for certain commands and features. Refer to the sections in the vi module that discuss the requirements for setting up your environment to use vi .


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net