• Aucun résultat trouvé

CHANGE Command

Dans le document Professional Editor (Page 174-180)

Purpose: The CHANGE command searches the text buffer for a given string and replaces that string with another string. The operation is performed within the limits of any boundaries defined by the BOUNDS command.

Format: CHANG E

I

C /stringl/string2/n [lbound [rboundJ]

Remarks: stringl is the search string. string2 is the change string. n is the repeat count. lbound and rbound are optional local boundary limits.

7-8

The operands stringl, string2, and n are separated by an arbitrary non-blank delimiter, shown as / above. The first non- blank character following the blank which follows the command verb (CHANGE or C) is used as the delimiter in separating the operands. The local bounds lbound and rbound, if specified, are separated from the preceeding operands by one or more blanks.

The search string (stringl) must be a non-null string and may have a maximum length of 40 characters.

The change string (string2) is used to replace the search string in the text. It may be a null string and may have a maximum length of 40

characters. A change argument with zero characters (a null string) replaces the search argument found in the text with nothing, deleting the occurrence from the file text. On entry, the change argument is saved along with

CHANGE Command

the search argument and may be used in future search and change operations.

The repeat count n may have a value of

°

through 65535. If you do not enter a repeat count, a default value of zero is assumed. You can set the repeat count to an infinite value by using the character

*.

If the count is 1, the change operation looks for the first occurrence (the next occurrence) of the search argument and, if found, makes the change. If it is greater than 1, the change operation locates the next n occurrences of the search argument in the file and, if found, makes the change.

If the repeat count is omitted or 0, the search and change arguments are defined, but no change operation is performed. The SRCH X and CHNG X function keys are then enabled, allowing you to perform repeated search and/ or change operations by pressing the function keys.

This allows you to make selective changes throughout the file text by using SRCH to find the next occurrence. If you want to make the change, press the CHNG D key. If not, press a SRCH key to continue the scan in the desired direction.

You can specify the optional local boundaries as

CHANGE Command

7-10

When a change operation is limited by boundaries, an occurrence of the search argument is not detected if any portion of the matching string in the file text lies outside either the left or right boundaries.

If you do not specify local boundaries in a CHANGE command, the global boundaries (if any) will limit the scope of the change

operation.

Specifying the Starting Position and Direction of Change

A change operation always has a starting point, which may be:

• The current position, which is the character above the cursor on the screen.

• The top of the text buffer if the change is a forward change.

• The bottom of the text buffer if the change is a backward change.

CHANGE Command

In addition to a starting point, a change operation also has a direction which may be either forward (toward the bottom of the text buffer) or backward (toward the beginning of the text buffer).

When you enter a CHANGE command, you specify the starting point and direction by using the appropriate verb or abbreviation for the CHANGE command as follows:

CHANGE or C or

CHANGED or CD

Performed in the forward direction ( downward), starting at the current position.

CHANGED or CD Performed in the backward direction (upward), starting at the current position.

CHANGEF or CF Performed in the forward direction ( downward), starting at the start of the text buffer. This operation changes the first

occurrence if the count is 1.

CHANGEL or CL Performed in the backward

CHANGE Command

7-12

Repeating a Change Operation

Once you have defined both arguments in a CHANGE command, you can perform

additional change operations by entering one of the above CHANGE commands without any operands or by using the change function keys.

Once you enter a SEARCH or CHANGE, the search function keys SRCH D, SRCH U,

SRCH F, and SRCH L and change function keys CHNG D, CHNG U, CHNG F, and CHNG L remain enabled until you exit to DOS. After the arguments are defined, you may use them to quickly repeat a search and change operation.

To repeat the change forward (downward) from the current position, enter the command CHANGE, C, CHANGED, or CD, or press the CHNG D function key.

To repeat the change backward (upward) from the current position, enter the command CHANGEU or CU, or press the CHNG U function key.

To change the first occurrence, enter the command CHANGEF or CF, or press the CHNG F function key.

To change the last occurrence, enter the command CHANGEL or CL, or press the CHNG L function key.

Example: CHANGE /print/type/5 1 80

CHANGE Command

This command changes the next five

occurrences of the word prin t to the word type, but only in columns 1-80. Occurrences outside of those boundaries are not changed.

COLUMN

Dans le document Professional Editor (Page 174-180)

Documents relatifs