Previous Next Chapter

EDIT

EDIT is a line editor designed for the automated editing of files, particularly binary files or files that are larger than available memory. You cannot create a new file with EDIT.

EDIT processes files line by line. As EDIT moves through the input, or source file, each line is passed after alteration to a sequential output file, the destination file.

EDIT processes the lines in files in a forward direction; however, you can move backward a limited number of lines. EDIT holds the lines in an output queue before writing them to the destination file. The size of this queue depends on the amount of memory available. You can increase the size of the queue with the OPT P and OPT W options.

The format for EDIT is the following:

EDIT [FROM] <filename> [[TO] <filename>] [WITH <filename>] [VER <filename>] [OPT P <lines> | W <chars> | P<lines>W<chars>] [WIDTH <chars>] [PREVIOUS <lines>]

The FROM argument specifies the source file to be edited. You must specify a source file with EDIT, although the FROM keyword is optional.

The TO argument specifies the destination file to which EDIT sends its output, including editing changes. If you omit the TO argument, EDIT uses a temporary file. This temporary file is renamed with the name of the FROM file and overwrites the FROM file when editing is complete.

The WITH keyword specifies a file containing editing commands.

The VER keyword specifies the file to which EDIT sends error messages and line verifications. If the VER argument is not given, EDIT uses the screen.

Use OPT P <n> and OPT W <n> to specify the PREVIOUS and WIDTH options. However, do nit use the OPT keyword with PREVIOUS and WIDTH.

You can use the PREVIOUS and WIDTH options to increase or decrease the amount of available memory. The PREVIOUS option sets the number of previous lines available to EDIT to the integer <n>. The WIDTH option sets the maximum number of characters allowed on a line to <n>. EDIT multiples the number of previous lines by the maximum number of characters (PREVIOUS * WIDTH) to determine the available memory. The default values are PREVIOUS 40 WIDTH 120.

Starting EDIT

Start EDIT through a Shell using the following command:

1.< EDIT <filename>

Where <filename> is the name of an existing file to be edited.

EDIT Commands

The following list provides background information about EDIT commands:

Current line

Refers to the line that EDIT is working on at any time. Every command entered refers to the current line, all text changes are made to the current line, and new lines are inserted before the current line.

Original lines

The lines of the source file. Lines retain their original number until you renumber them with the REWIND or = commands.

Non-original lines

Any lines that are inserted into the source file or original lines that are split. These are not assigned line numbers.

Line verification

When using commands that change information in a line, EDIT displays the revised line after the command is executed.

Arguments

Strings, qualified strings, numbers, and switch values used with EDIT commands.

Enter commands in one of the following three ways:

The text conventions used in the command description are the following:

Selecting the Current Line

The following commands let you move through the file and select the current line.

Move to a specific line number

M <n>

Specify a new current line by entering its line number, a period, and an asterisk as M's argument. Only original lines can be accessed by line number.

Move to next line in the source file

N

Move forward one line. Entering a number and N indicates the number of lines to move forard. When used as the last line of the source file, EDIT creates an extra line at the end of the file. If you are already on this extra line, using N causes an error message to be displayed.

Move to the previous line in the source file

P

Moves back one line. Entering P repeatedly moves more than one line. Entering a number + P indicates how many lines to move back. You can only move back to previous lines that have not yet been written to the destination file. The default is 40 lines, which can be changed with the PREVIOUS option.

Find

F<string>

Lets you select a current line by specifying some of its content.

Search Backward

B,F<string>

Looks backward starting from the current line through the source file for a line containing the specified string.

Top Previous Next Chapter