[SRX] How to send quotation mark in the Secure CRT script

  [KB18341] Show Article Properties


Summary:

This article provides information on how to send quotation mark and vertical line in the Secure CRT script.

Symptoms:

At times, we need to filter some of the output from the command line interface of JunOS in a SecureCRT script. For example:

root@jtac-ex4550-32f-fl-r2042# run show configuration | display set | match "lab" 
Solution:

You can use either a double quote " or Chr(34) to accomplish this. Chr(124) is the equivalent of vertical line |. Note that Chr(13) refers to  Enter CR/.

In the SecureCRT script:

#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True

Sub Main
 crt.Screen.Send "run show configuration " & chr(124) & " display set " & chr(124) & " match " & chr(34) & "lab" & chr(34) & chr(13)


End Sub

*************************

Above script generates the output below:

root@jtac-ex4550-32f-fl-r2042# run show configuration | display set | match "lab" 
set system login user labroot uid 2001
set system login user labroot class super-user
set system login user labroot authentication encrypted-password "$5$zKZc7yhx$/piZ6Kn4BtunTiZ1NGP6tKB9AMayVkG1KHgriFZK1T5"

Modification History:
2019-10-22: Updated to fit all Junos. Removed from archive.
2019-09-07:  Archived article.
Related Links: