R12.1-JA-2025June05

Detect Hostname and CLI Commands

The hostname and CLI commands can be detected from the following two sources. Both can get the hostname and CLI commands using simple regular expressions containing $hostname and $cmd.

  • From File Content: Get the hostname and CLI commands by parsing the file content.
    ExampleIf the file contains texts like r1#show version, you can define the pattern $hostname#$cmd to parse such content.
    表格  描述已自动生成
    For a set of files, multiple patterns can be defined by clicking + Pattern. NetworkBrain has defined a set of default Patterns, you can modify them and add more if needed.
    图形用户界面, 文本, 应用程序, 电子邮件  描述已自动生成
    Moreover, if you select the Detect First N Lines check box, indicating that only the first N lines in the imported file can be detected, which is not selected by default.
  • From File Name: this is often used for 2 kinds of file format: (1) the file is named by both device hostname and command name, and each of the file contains one device command only. (2) the file is named by device hostname only, and all the commands in the file content belong to the device only. E.g., save ‘show tech’ command texts in one file for each Cisco IOS device.  

During the parsing, the matching is performed from top to bottom, and the first matched pair of hostname and command will be adopted, and the others will be ignored. That is, if the From File Content and From File Name are both defined, the From File Content has higher priority than the From File Name.