All commands have the same display feature. You can flexibly specify the display mode as required.
When the information cannot be completely displayed on one screen, you can adopt the pause function. You have three choices, as described in Table 1.
Key |
Function |
---|---|
Space bar |
Continues to display the information on the next screen. |
Enter |
Continues to display the information in the next line. |
Plus sign (+)+regular-expression |
Functions the same as | include regular-expression. |
Minus sign (-)+regular-expression |
Functions the same as | exclude regular-expression. |
Slash (/)+regular-expression |
Functions the same as | begin regular-expression. |
Ctrl+C+ any other key |
Stops displaying information and executing commands. |
A regular expression describes a pattern that matches a set of character strings. It consists of common characters (such as characters a to z) and special characters (also called metacharacters). The regular expression functions as a template to match a character pattern with the searched character string.
The regular expression has the following functions:
Checks and obtains the sub-character string that matches a certain rule in the character string.
Replaces the character string based on the matching rule.
Common and special characters contained in the regular expression are described as follows:
Common characters
Common characters match common characters in the character string, including all uppercase letters, lowercase letters, digits, punctuation marks, and special symbols. For example, a matches a in abc, and @ matches @ in xxx@xxx.com.
Special characters
Special characters, together with common characters, match complicated or special character strings. For example, ^10 matches 10.10.10.1 not 2.2.2.2.
Table 2 describes special characters and their functions.
Special Character |
Function |
Example |
---|---|---|
\ |
Defines an escape character, which is used to mark the next character (common or special) as a common character. |
\* matches *. |
^ |
Matches the start position of the string. |
^10 matches 10.10.10.1 not 2.2.2.2. |
$ |
Matches the end position of the string. |
1$ matches 10.10.10.1 not 10.10.10.2. |
* |
Matches the preceding element zero or more times. |
10* matches 1, 10, 100, 1000, and so on. (10)* matches null, 10, 1010, 101010, and so on. |
+ |
Matches the preceding element once or more times |
10+ matches 10, 100, 1000, and so on. (10)+ matches 10, 1010, 101010, and so on. |
? |
Matches the preceding element zero times or once. NOTE:
Huawei datacom devices do not support regular expressions with ?. When regular expressions with ? are entered on Huawei datacom devices, helpful information is provided. |
10? matches 1 or 10. (10)? matches null or 10. |
. |
Matches any single character. |
a.b matches any string that starts with a, ends with b, and contains three characters. 0.0 matches 0x0, 020, and so on. .oo matches book, look, tool, and so on. |
() |
Matches and obtains a string within the parentheses. If the parentheses are empty, the string is equivalent to a null string. If a pattern string has only (), it can match any string. If the right parenthesis in a pattern string has no matching left parenthesis, the right parenthesis is used as a common character. If the left parenthesis in a pattern string has no matching right parenthesis, the pattern string is invalid. |
100(200)+ matches 100200, 100200200, and so on. (ab) matches abcab. () can match any string. a()b matches 12ab12. a)b matches za)bc. a(b is an invalid pattern string. |
_ |
Matches regular expressions with a sign, such as a comma (,), left brace ({), right brace (}), left parenthesis ((), right parenthesis ()), or space. The underscore (_) can be used at the beginning of a regular expression with the same function as the caret (^) or at the end of a regular expression with the same function as the dollar sign ($). |
_65001_ matches 20 65001 30, 20 65001, 65001 30, 65001, and so on. |
x|y |
Matches x or y. |
100|200 matches 100 or 200. 1(2|3)4 matches 124 or 134 not 1234, 14, 1224, or 1334. |
[xyz] |
Matches any character in the regular expression. It cannot simultaneously match multiple characters or match the same character for multiple times. |
[123] matches 2 in 255. [abc] matches characters a, b, and c. |
[^xyz] |
Matches characters excluding x, y, and z in a character string. That is, it matches any string with at least one character that is not x, y, or z. |
[^123] matches any character except 1, 2, and 3. [^abc] matches any character except a, b, and c. |
[a-z] |
Matches any character within a specified range. It cannot simultaneously match multiple characters or match the same character for multiple times. |
[0-9] matches any character within the specified range. [a-z] matches any character within the specified range. [z-a] is an invalid pattern string. |
[^a-z] |
Matches characters except a, b, c, and d in a character string. That is, it matches any string with at least one character that is beyond the range of a to d. |
[^0-9] matches all non-digit characters. [^a-z] matches all non-letter characters. [^z-a] is an invalid pattern string. |
Unless otherwise specified, all characters in the preceding table are displayed on the screen.
Degeneration of special characters
Certain special characters degenerate to common characters when being placed at special positions in the regular expression.
The special characters following "\" are transferred to match special characters themselves.
The special character "*", "+", or "?" is placed at the start position of the regular expression. For example, +45 matches +45 and abc(*def) matches abc*def.
The special character "^" is placed at any position except the start position of the regular expression. For example, abc^ matches abc^.
The special character "$" is placed at any position except the end position of the regular expression. For example, 12$2 matches 12$2.
The right bracket (for example, ")" or "]") is not paired with its corresponding left bracket "(" or "[". For example, abc) matches abc) and 0-9] matches 0-9].
Unless otherwise specified, degeneration rules are applicable when the preceding regular expressions serve as subexpressions within parentheses.
Combination of common and special characters
In practice, multiple common and special characters are often combined to match a special character string.
The NetEngine 8000 F supports filter criteria based on a regular expression. All display commands support regular expressions. If filter criteria are specified in a display command, the first line in the command output is a complete message that contains the specified character string, instead of a message that starts with the specified character string.
| count can be specified to control the number of lines to be displayed in the command output, and | no-more can be specified so that the command output is displayed on one screen. | count or | no-more can be used independently or used with any of the following filter criteria.
| ignore-case can be specified so that the character string is case-insensitive, and | section can be specified to control the segment to be displayed in the command output. | ignore-case or | section must be used with any of the following filter criteria.
For the commands supporting regular expressions, you can choose the following filter criteria:
| begin regular-expression
Displays all the lines following the line that matches the regular expression. That is, the system displays both the line that contains the specified character string (case-sensitive) and all the following lines on a terminal.
| exclude regular-expression
Displays all the lines that do not match the regular expression. That is, the system displays only the lines that do not contain the specified character string (case-sensitive) on a terminal. If no line matches, the output is empty.
| include regular-expression
Displays only the lines that match the regular expression. That is, the system displays only the lines that contain the specified character string (case-sensitive) on a terminal. If no line matches, the output is empty.
The command output can be filtered by multiple regular expressions. The regular expressions take effect in configuration sequence. A maximum of 32 regular expressions can be configured to filter the command output. For example, you can run the display current-configuration | section include ip | exclude address 10.1 | exclude description command to display the command output that contains ip but does not contain address 10.1 or description.
When you run a display command with filter criteria set, note the following:
The NetEngine 8000 F can redirect the output of a display command to a specified file in either of the following modes:
> filename
The output is redirected to a specified file. If the file already exists, the content of the file is overwritten.
>> filename
The output is appended to a specified file, with the original content of the file remaining unchanged.
If the interval is too short, the CPU usage will increase. Set the interval to a proper value.
If the number of VTY channels is less than four, | refresh cannot be specified for a new command. The commands with | refresh specified are not affected.
Only commands starting with display support display.