Next: CMDSEP
Previous: CDELETE
Up: The Commands in Detail
CHANGE [col1 [col2]] /old[/[new[/ [n] [A] [D] [H] [I]]]
C
Related command: REPLACE
In the current line the character string `old' is replaced by
the character string `new'.
The basic syntax of the CHANGE command is
In this formula you have to put character strings for `old' and
`new'. The character strings have to be embedded in delimiters,
which is a `/' in this text. As a delimiter, you may use any
character except digits or spaces. In practice, the special character
on the lower right of your keyboard # proved to be very useful.
You only have to choose a different delimiter if this character
occurs in the old or new character string.
Abbreviations:
is possible if you do not need one of the parameters.
is sufficient if you do not want to replace the character string but
only delete it. If you want to delete a character string and need
one of the parameters, you have to write CHANGE /old//...
is a further abbreviation of CHANGE /old/.
Restriction to columns:
Normally, the character string may be at any place within a record.
You can restrict the possible position of the character string to
certain columns with the command ZONE (compare the entry for
this command). A restriction of the zone for the search with the
CHANGE command is possible as well by specifying the columns.
For example,
only changes the character string `old' if it occurs between
the columns 10 and 20, both inclusive. In this specification the
borders of the ZONE area are ignored. If you specify only
one column, the CHANGE command will operate from this column on to
the last column of the record.
Expansion on several lines (records):
Without specifications changes are only done within the current line.
With the specification of the number of lines n, for example
you ask exaEdit to search for the old character string within the
current line and the n-1 following lines and to do the changes
there if necessary.
If the character string `old' is not found within the specified
lines, the current line keeps its position and you receive the message
Character string not found: old
In opposition to this, if the character string is found m times,
the current line moves by n lines downward (consequently, the
data in the visible part of the window move by n lines upward)
and you receive the message
By default, the search string is only searched for once per record.
If the record contains the string more than once, only the one furthest
to the left will be changed. To change all occurrences of the string
you have to use the parameter
When using the parameter
(=`display'), all lines that have been changed are displayed in
the dialogue zone.
You can edit in hexadecimal form by giving the parameter
To this end, the given (one or two) character strings must be written
in hexadecimal form. Since 1 byte is always defined by 2 hexadecimal
characters,
exaEdit always demands that the amount of the entered hexadecimal
characters is even. Otherwise exaEdit will generate the error message
Odd number of hex characters
Entering a character that is not hexadecimal results in the error message
If, for example, you would like to delete all Carriage Return characters
(hexadecimal 0d) in a file, you select the top line of the workfile
and enter
(Here the precondition would be that the file has less than 1000 lines
and 0d appears only once per record.)
When the parameter
( = `case-insensitive')
is given, the search for the character string that is to be changed
will be case insensitive (i.e. no distinction between lower and upper
case characters). This means that
will change either ab or Ab or aB or AB.
If you have to use the parameter I regularly, the use of the command
CASE is recommended. CASE can force other commands to act as if
the parameter I was given. For further information see
CASE.
You are not allowed to specify the commands I and H together.
If you do it still, the parameter I will be ignored with the message
'I' will be ignored as H is specified
The command will then be executed as if only H had been given.
Next: CMDSEP
Previous: CDELETE
Up: The Commands in Detail