REPLACE - Replace a File

Syntax


REPLACE

{ line-control-range }

[ filename ]

[ X | NX ]

[ U | NU ]


Operands


line-control-range

The range of lines which are to be included by the command.  Line control ranges provide a powerful tool to customize the range of lines to be included.   The full syntax and allowable operands which make up a line control range is discussed in "Line Control Range Specification".  Refer to that section of the documentation for details.


Note:  Prior editions of this document showed syntax that implied that the line-control range on REPLACE was optional.  That is not correct.  You must specify a line-control-range, unless the line-control-range is implied via a C/CC or M/MM block.  We are trying to emphasize that fact by showing the syntax in red above, and in braces rather than brackets.


file-name

The name of the file you wish to replace.


X | NX

Specifies a subset of the line range to be included.   X requests only excluded lines are to be included, NX requests only non-excluded lines are to be included.   If neither X or NX are specified, all lines in the range will be included.        

U | NU

Specifies a subset of the line range to be included.   U requests only User lines are to be included, NU requests only non-User lines are to be included.   If neither U or NU are specified, all lines in the range will be included.



Description


REPLACE will use all or a specified portion of the Edit data to replace a new external file. If you do not specify a full pathname as part of file-name, then the file will be created in the same directory as the file being edited. Note: If the filename does not already exists, then command will create it as a new file.  The CREATE and REPLACE commands are almost identical, except CREATE prevents overwriting of an existing file, whereas REPLACE does not.


To copy the entire Edit data into an existing file:


On the Command line, type:


REPLACE file-name


The filename operand is optional. If you do not specify it, the standard Windows File Open dialog will be displayed. Enter the filename in this dialog.


Press Enter. The entire Edit data will replace the existing contents of the filename.  



To copy only a portion of the Edit data into an existing file:


On the Command line, type:

REPLACE filename line-control-range


The filename operand is optional. If you do not specify it the standard Windows File Open dialog will be displayed. Enter the filename in this dialog.  


The line-control-range would typically specify the starting and ending line numbers to be included in the replaced file (or some other line-control-range variation). As described under "Line Control Range Specification" a variety of other possibilities for specifying the line range exist including marking the lines with the CC/CC or MM/MM line commands.


Press Enter. The specified Edit data is copied/moved to replace the specified filename.


File Format


If you wish to write a file in a format other than the normal default specified by your PROFILE EOL and SOURCE settings see "Handling Non-Windows Text Files" for additional info.


Default Directory


When no operand at all or only a simple unqualified filename is provided for the REPLACE command, the default directory used for writing the file or for the file open dialog's starting directory will be determined as follows:




Created with the Personal Edition of HelpNDoc: News and information about help authoring tools and software