<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > Filesystem-Commands |
MiniRobotLanguage (MRL)
CVF. Command
Coonvert File / Replace in File
Intention
This command is used to replace characters in a file and then write the file to an output file. Technically CVF. will load the whole file into memory and then do the replace.
You can convert files with different line-endings:
$$FIL=?path\MyFIle.xml
$$OUT=?path\MyFIle.txt
$$MAC=$lf$
$$PCE=$crlf$
CVF.$$FIL|$$MAC|$$PCE|$$OUT
or you can convert a XML-File into a textual readable file:
$$FIL=?path\MyFIle.xml
$$OUT=?path\MyFIle.txt
$$XML=><
$$PCE=>$crlf$<
CVF.$$FIL|$$XML|$$PCE|$$OUT
If you omit P4 then P1 is overwritten without further asking!
Syntax
CVF.P1|P2|P3[|P4]
Parameter Explanation
P1 - Filename
P2 - (Replace) Text or Data that is going to be replaced
P3 - (with) Text or Data that is going to replace the text P2
P4 - Opt. Variable which contains the Output filename, that the processed
file should be written to. If omitted P1 is overwritten!
Example
'*****************************************************
' EXAMPLE 1: CVF.
'*****************************************************
$$FIL=?path\MyFIle.xml
$$OUT=?path\MyFIle.txt
$$MAC=$lf$
$$PCE=$crlf$
CVF.$$FIL|$$MAC|$$PCE|$$OUT
MBX.!
END.
Remarks
Existing files with the given file-name P4 will be overwritten without any confirmation-request.
Limitations:
-
See also: