No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Command Reference

CloudEngine 8800, 7800, 6800, and 5800 V200R002C50

This document describes all the configuration commands of the device, including the command function, syntax, parameters, views, default level, usage guidelines, examples, and related commands.
Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Filtering Command Outputs

Filtering Command Outputs

Filtering command outputs help you quickly find the information you need. For example, you can use a regular expression (specifying the rule to filter information) in a display command filter the output information.

Display Feature

When the information cannot be completely displayed on one screen, you can adopt the pause function. You have three choices, as described in Table 2-8.

Table 2-8  Display functions

Key

Function

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.

Regular Expressions

A regular expression is a mode matching tool. It consists of common characters (such as letters from a to z) and special characters (called meta-characters). The regular expression is a template according to which you can search for the required string.

A regular expression provides the following functions:
  • Searches for and obtains a sub-string that matches a rule in the string.

  • Substitutes a string based on a certain matching rule.

The regular expression consists of common characters and special characters.

  • Common characters

    Common characters are used to match themselves in a string, including all upper-case and lower-case letters, digits, punctuations, and special symbols. For example, a matches the letter "a" in "abc", 10 matches the digit "10" in "10.113.25.155", and @ matches the symbol "@" in "xxx@xxx.com".

  • Special characters

    Special characters are used together with common characters to match the complex or special string combination. Table 2-9 describes special characters and their syntax.

    Table 2-9  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 20.10.10.1.

    $

    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:

    When regular expressions with a question mark (?) are entered on Huawei datacom devices, helpful information is displayed. However, if the command output is displayed on more than one screen and filter criteria followed by a question mark (?) are entered, this question mark is considered a special character of a regular expression.

    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.

    NOTE:

    Unless otherwise specified, all the characters in the preceding table must be printable characters.

  • Degeneration of special characters

    Certain special characters, when placed at certain positions in a regular expression, degenerate to common characters.

    • The special characters following "\" match special characters themselves.

    • The special characters "*", and "+" are placed at the starting 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 for the start of the regular expression. For example, abc^ matches "abc^".

    • The special character "$" is placed at any position except for the end of the regular expression. For example, 12$2 matches "12$2".

    • A right parenthesis ")" or right bracket "]" is not paired with a corresponding left parenthesis "(" or bracket "[". For example, abc) matches "abc)" and 0-9] matches "0-9]".

    NOTE:

    Unless otherwise specified, degeneration rules also apply when the preceding regular expressions are subexpressions within parentheses.

  • Combination of common and special characters

    In actual usage, regular expressions combine multiple common and special characters to match certain strings.

Specifying a Filtering Mode in a Command

NOTE:

When filtering conditions are set to query output information, the first line of the command output starts with the entire regular expression but not the string to be filtered.

The system allows you to use | count to display the number of lines, | section to display the command output by section after using filtering mode, | ignore-case to match a string of case-insensitive characters, and | no-more to display filtered output information on only one screen. | count, | section, | ignore-case, and | no-more can work together with the following filtering modes.

Three filtering modes are provided for commands that support regular expressions.

  • | begin regular-expression: displays all the lines beginning with the line that matches the regular expression.

    Filter the character strings to be entered until the specified case-sensitive character string is displayed. All the character strings following this specified character string are displayed on the screen.

  • | exclude regular-expression: displays all the lines that do not match the regular expression.

    If the character strings to be entered do not contain the specified case-sensitive character string, they are displayed on the screen. Otherwise, they are filtered.

  • | include regular-expression: displays all the lines that match the regular expression.

    If the character strings to be entered contain the specified case-sensitive character string, they are displayed on the screen. Otherwise, they are filtered.

NOTE:

The value of regular-expression is a string of 1 to 255 characters.

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.

The | section parameter only applies to commands whose output information contains section information, such as the display current-configuration and display this commands.

The following examples describe how to specify a filter mode in a command.

Example 1: Run the display interface brief command to display all the lines that do not match the regular expression 10GE|40GE. 10GE|40GE matches 10GE or 40GE.

<HUAWEI> display interface brief | exclude 10GE|40GE
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): EFM down
(d): Dampening Suppressed
(p): port alarm down
(dl): DLDP down
InUti/OutUti: input utility rate/output utility rate
Interface                   PHY   Protocol InUti OutUti   inErrors  outErrors
Eth-Trunk2                  down  down        0%     0%          0          0
Eth-Trunk27                 up    up       0.01%  0.01%          0          0
MEth0/0/0                   up    up       0.01%  0.01%          0          0
NULL0                       up    up(s)       0%     0%          0          0
Vlanif2                     down  down        --     --          0          0
Vlanif10                    down  down        --     --          0          0
Vlanif20                    down  down        --     --          0          0
Vlanif200                   up    up          --     --          0          0

Example 2: Run the display current-configuration command to display all the lines that match the regular expression vlan.

<HUAWEI> display current-configuration | include vlan
vlan batch 2 9 to 20 77 99 200 222 4091
vlan 19
 mux-vlan
vlan 222
 aggregate-vlan
 access-vlan 1
 instance 2 vlan 2
 carrier-vlan 100
 ce-vlan 10
 port trunk allow-pass vlan 99 200
 igmp-snooping static-router-port vlan 99
 port trunk allow-pass vlan 20
 port default vlan 77
 port trunk allow-pass vlan 20

Example 3: Run the display current-configuration command to display the number of lines that match the regular expression vlan.

<HUAWEI> display current-configuration | include vlan | count
Total lines: 14.
NOTE:

The preceding information is used for reference only.

The device 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.

Translation
Download
Updated: 2019-03-21

Document ID: EDOC1000166501

Views: 50176

Downloads: 337

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next