The PRINT keyword allows the printing of simple text strings (similar to the C "printf" command) and the printing of values within variables in CCS scripts to output text files. Action-Command attributes and Trigger-Command attributes may use the PRINT keyword. You can view file output in the Files tab in the Job Viewer. You can append successive PRINT outputs to the same file. You specify variables output using the $<variable_name> directive. Avoid using other special characters as they may conflict with tokens used by the CCS scripting engine.
Examples
PRINT:
...
This
...
is
...
the
...
output
...
of
...
the
...
show
...
running-config
...
command
The statement in quotation marks is written to an automatically-named file <device_id>-1.log. You can also direct the output of the PRINT keyword to a specific filename:
PRINT
...
(config_listing.txt):
...
This
...
is
...
the
...
output
...
of
...
the
...
show
...
running-config
...
command
The statement in quotation marks is written to a specified file named config_listing.txt. Similar to the ARCHIVE keyword, you can use variables to dynamically specify file names:
PRINT
...
($ip_address.txt):
...
This
...
is
...
the
...
output
...
of
...
the
...
show
...
running-config
...
command
The statement writes a series of files to specified filenames for each of the devices against which the script executes, after the script-filter is applied.
PRINT can be used to append successive notes into the same output file:
Action-Commands:
PRINT
...
($ipaddress.txt):
...
This
...
is
...
the
...
output
...
of
...
show
...
running-config
...
ARCHIVE
...
($ipaddress.txt):
...
show
...
running-config
ARCHIVE
...
($device_devicename.txt):
...
show
...
running-config
PRINT
...
($ipaddress.txt):
...
Expect
...
this
...
to
...
be
...
the
...
same
...
as
...
show
...
startup-config
...
ARCHIVE
...
($ipaddress.txt):
...
show
...
startup-config
ARCHIVE
...
($device_devicename.txt):
...
show
...
startup-config
In this case <$device_devicename>.txt files contain the text This is the
...
You can use PRINT to output the contents of variables to an external file:
Action-Commands:
PRINT
...
($ipaddress.txt):
...
$ipaddress
...
is
...
a
...
$model
This script directive prints the contents of two variables to the file <$ip_address>.txt.