Filter the results of an executed script
Use the Filter results that match a pattern option to display in the results of the executed script only those lines that conform to your regular expression pattern.
The option accepts any valid regular expression.
The following examples illustrate some of the uses of Regular Expression patterns:
snmp-server community public
Finds any line that includes the text snmp-server community public
. There can be text before and/or after the string on the same line.
service tcp-keepalives-in.*\n(.*\n)*.*service tcp-keepalives-out
Finds the first line service tcp-keepalives-in
and then looks for service tcp-keepalives-out
on any line after that. The regular expression string .*\n(.*\n)*.*
is used to search any number of lines between strings.
access-list 105 deny.*tcp any any eq 139 log
Finds the line with access-list 105 deny
, followed by any number of characters of any type, followed by tcp any any eq 139 log
on the same line. The regular expression string .*
finds any character, and any number of characters on the same line. So, this could be used to find spaces, tabs, numbers, letters, or special characters.
ntp clock-period \d*
Finds any line that includes ntp clock-period
followed by any number. The regular expression string \d*
will find any number at any length, such as 3
, 48
, or 2394887
.
user \x2a
Finds any line that includes user *
. The regular expression string \x
followed by a hexadecimal value specifies an individual character. In this example, \x2a
represents the asterisk character, which has a hexadecimal value of 2a
.