Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

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

In this case <$ipaddress>.txt files contain the text This is the output of show running-config followed by the output of an executed show running-config command, followed by another text statement "Expect this to be the same as show startup-config" followed by the output of a show startup-config command.

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.

  • No labels