Pipe/match

The 7210 SAS devices support the pipe feature to search one or more files for a specific character string or pattern.

Note:

When using the pipe/match command the variables and attributes must be spelled correctly. The attributes following the command and must come before the expression/pattern. The following are examples of the pipe/match command to complete different tasks:

Command syntax:

match pattern context {parents | children | all} [ignore-case] [max-count lines-count] [expression]
    match pattern [ignore-case] [invert-match] [pre-lines pre-lines] [post-lines lines-count] [max-count lines-count] [expression]

where:

pattern      string or regular expression
context      keyword:  display context associated with the matching line
parents      keyword:  display parent context information
children     keyword:  display child context information
all          keyword:  display both parent and child context information
ignore-case  keyword
max-count    keyword:  display only a specific number of instances of matching lines
lines-count  1 — 2147483647
expression   keyword:  pattern is interpreted as a regular expression
invert-match keyword
pre-lines    keyword:  display some lines prior to the matching line
pre-lines    0 — 100
post-lines   keyword:  display some lines after the matching line
lines-count  1 — 2147483647

Example
*A:Dut-G# show log log-id 99 | match ignore-case sap
"Processing of an access port state change event is finished and the status of all
 affected SAPs on port 1/1/21 has been updated."
"Service Id 4001, SAP Id 1/1/21:0.* configuration modified"


A:Dut-C# show log log-id 98 | match max-count 1 "service 1001"
"Status of service 1001 (customer 1) changed to administrative state: up, operationa
l state: up"

*A:Dut-G# admin display-config | match post-lines 4 max-count 2 expression "vpls"
#--------------------------------------------------
...
        vpls 1 customer 1 svc-sap-type null-star create
            description "Default tls description for service id 1"
            stp
                shutdown
            exit
        vpls 2 customer 1 svc-sap-type null-star create
            description "Default tls description for service id 2"
            stp
                shutdown
            exit
...
#--------------------------------------------------

The following table describes regular expression symbols and interpretation (similar to what is used for route policy regexp matching). Table: Special characters describes special characters.

Table: Regular expression symbols

String

Description

.

Matches any single character.

[ ]

Matches a single character that is contained within the brackets.

[abc] matches ‟a”, ‟b”, or ‟c”. [a-z] matches any lowercase letter.

[A-Z] matches any uppercase letter.

[0-9] matches any number.

[^ ]

Matches a single character that is not contained within the brackets.

[^abc] matches any character other than ‟a”, ‟b”, or ‟c”.

[^a-z] matches any single character that is not a lowercase letter.

^

Matches the start of the line (or any line, when applied in multiline mode)

$

Matches the end of the line (or any line, when applied in multiline mode)

()

Define a ‟marked subexpression”.

Every matched instance will be available to the next command as a variable.

*

A single character expression followed by ‟*” matches zero or more copies of the expression.

{m,n}

Matches at least m and at most n repetitions of the term

{m}

Matches exactly m repetitions of the term

{m,}

Matches m or more repetitions of the term

?

The preceding item is optional and matched at most once.

+

The preceding item is matched one or more times.

-

Used between start and end of a range.

\

An escape character to indicate that the following character is a match criteria and not a grouping delimiter.

>

Redirect output

Table: Special characters

Options

Similar to

Description

[:upper:]

[A-Z]

uppercase letters

[:lower:]

[a-z]

lowercase letters

[:alpha:]

[A-Za-z]

upper- and lowercase letters

\w

[A-Za-z_]

word characters

[:alnum:]

[A-Za-z0-9]

digits, upper- and lowercase letters

[:digit:]

[0-9]

digits

\d

[0-9]

digits

[:xdigit:]

[0-9A-Fa-f]

hexadecimal digits

[:punct:]

[.,!?:...]

punctuation

[:blank:]

[ \t]

space and TAB

[:space:]

[ \t\n\r\f\v]

blank characters

\s

[ \t\n\r\f\v]

blank characters