The escape
statement is used to escape quotes in a variable value or the contents of a named buffer
escape quotes in
varName|{bufferName}
If a variable value or named buffer contains quotes then it may be desirable to escape them, either for display purposes (to prevent USE from removing them before rendering the data as output) or in order to satisfy the requirements of an external API.
The escape
statement will precede all occurrances of the character "
with a backslash as shown in the example below. This operation is not just temporary - it will update the actual contents of the variable or named buffer.
The escape
statement does not consider the context of any existing quotes in the data. Running it multiple times against the same data will add an additional escape character each time to each occurrence of a quote.
Given an input file called 'escapeme.txt' containing the following data:
The following script:
will produce the following output: