Pipe/Match

The 7705 SAR supports the pipe/match (...| match) feature to search one or more files for a specified character string or pattern.

Match 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: a string or regular expression (maximum 200 characters)

context: displays the context associated with the matching line

parents: displays the parent context information

children: displays the child context information

all: displays both parent and child context information

ignore-case: ignores the case in the string (uppercase or lowercase)

max-count lines-count: displays the matching lines, up to the specified number (1 to 2147483647)

expression: the pattern is interpreted as a regular expression

invert-match: displays all the lines that do not contain the string specified in pattern

pre-lines pre-lines: displays the lines before the matching line, up to the specified number (0 to 100)

post-lines lines-count: displays the lines after the matching line, up to the specified number (1 to 2147483647)

For example:

*A:NOK-12# show service sap-using | match 1/1 pre-lines 10  
===============================================================================
Service Access Points 
===============================================================================
PortId                          SvcId      Ing.  Ing.    Egr.  Egr.   Adm  Opr
                                           QoS   Fltr    QoS   Fltr        
-------------------------------------------------------------------------------
1/1/1:333                       111        1     none    1     none   Up   Up
1/1/1:444                       111        1     none    1     none   Up   Up
1/1/9:10                        200        1     none    1     none   Up   Up
1/1/9:11                        200        1     none    1     none   Up   Up
1/1/9:12                        200        1     none    1     none   Up   Up
1/1/9:13                        200        1     none    1     none   Up   Up
1/1/9:14                        200        1     none    1     none   Up   Up
1/1/9:15                        200        1     none    1     none   Up   Up
A:NOK-12# show log log-id 98 | match ignore-case "sdp bind"
"Status of SDP Bind 101:1002 in service 1001 (customer 1)changed to admin=up oper=up
flags="
"Processing of a SDP state change event is finished and status of all affected SDP
Bindings on SDP 101 has been updated."

A:NOK-12# show log log-id 98 | match max-count 1 "service 1001"
"Status of service 1001 (customer 1)changed to administrative state: up, operational
state: up"

*A:NOK-12# admin display-config | match post-lines 5 max-count 2 expression "snmp”

        snmp
        exit
        login-control
            idle-timeout disable
            pre-login-message "csasim2 - " name
        exit
            snmp
                view "testview" subtree "1"
                    mask ff
                exit
                view "testview" subtree "1.3.6.1.2"
                    mask ff type excluded
*A:NOK-12#

Table: Pipe/Match Characters describes regular expression symbols and interpretation (similar to what is used for route policy regexp matching).

Table: Pipe/Match Characters

String

Description

.

Matches any single character

[ ]

Matches a single character with what 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 with what 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)

()

Defines a ‟marked subexpression”

Every matched instance is 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 criterion and not a grouping delimiter

Table: Special Characters identifies the special character options.

Table: Special Characters

Options

Similar to

Description

[:upper:]

[A-Z]

Uppercase letters

[:lower:]

[a-z]

Lowercase letters

[:alpha:]

[A-Za-z]

Uppercase and lowercase letters

\w

[A-Za-z_]

Word characters

[:alnum:]

[A-Za-z0-9]

Digits, uppercase 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