Cisco IOS multiple pipe

General 2018. 7. 21. 13:35

show interface | i (line protocol|error|rate)

 

 

bunker-3825-r1#show interface | i (line protocol|error|rate)

GigabitEthernet0/0 is up, line protocol is up

Queueing strategy: fifo

5 minute input rate 4882000 bits/sec, 1425 packets/sec

5 minute output rate 909000 bits/sec, 1188 packets/sec

2 input errors, 0 CRC, 0 frame, 2 overrun, 0 ignored

0 output errors, 0 collisions, 0 interface resets



Below the basic Cisco IOS regular expression characters and their functions.

Regular Expression Character

Function

Examples

.

Matches any single character.

    • 0.0 matches 0×0 and 020
    • t..t matches strings such as test, text, and tart

\

Matches the character following the backslash. Also matches (escapes) special characters.

    • 172\.1\.. matches 172.1.10.10 but not 172.12.0.0
    • \. allows a period to be matched as a period

[ ]

Matches the characters or a range of characters separated by a hyphen, within left and right square brackets.

    • [02468a-z] matches 0, 4, and w, but not 1, 9, or K

^

Matches the character or null string at the beginning of an input string.

    • ^123 matches 1234, but not 01234

?

Matches zero or one occurrence of the pattern. (Precede the question mark with Ctrl-V sequence to prevent it from being interpreted as a help command.)

    • ba?b matches bb and bab

$

Matches the character or null string at the end of an input string.

    • 123$ matches 0123, but not 1234

*

Matches zero or more sequences of the character preceding the asterisk. Also acts as a wildcard for matching any number of characters.

    • 5* matches any occurrence of the number 5 including none
    • 18\..* matches the characters 18. and any characters that follow 18.

+

Matches one or more sequences of the character preceding the plus sign.

    • 8+ requires there to be at least one number 8 in the string to be matched

() []

Nest characters for matching. Separate endpoints of a range with a dash (-).

    • (17)* matches any number of the two-character string 17
    • ([A-Za-z][0-9])+ matches one or more instances of letter-digit pairs: b8 and W4, as examples

|

Concatenates constructs. Matches one of the characters or character patterns on either side of the vertical bar.

    • A(B|C)D matches ABD and ACD, but not AD, ABCD, ABBD, or ACCD

_

Replaces a long regular expression list by matching a comma (,), left brace ({), right brace (}), the beginning of the input string, the end of the input string, or a space.

    The characters _1300_ can match any of the following strings:

    • ^1300$
    • ^1300space
    • space1300
    • {1300,
    • ,1300,
    • {1300}
    • ,1300,




MyRTR#show run ?

 brief       configuration without certificate data
 class-map   Show class-map information
 full        full configuration
 interface   Show interface configuration
 linenum     Display line numbers in output
 map-class   Show map class information
 policy-map  Show policy-map information
 view        View options
 |           Output modifiers
 <cr>

The option we are interested in is the “|” (Output modifier). We can quickly see that if we include that “|” as a parameter and use our trusty old “?”, we have more options.

MyRTR#show run | ?
 append    Append redirected output to URL (URLs supporting append operation
 only)
 begin     Begin with the line that matches
 exclude   Exclude lines that match
 include   Include lines that match
 redirect  Redirect output to URL
 section   Filter a section of output
 tee       Copy output to URL

The ones I find really useful are include, begin and section.  You can also play around with the exclude option as well.  I’ve not seen any real world use cases for the rest (but I’m sure they exist).  The simplest of these to understand is the “include” command.  This command parses the output of whatever command precedes the “|” and only presents whatever matches a filter that we need to provide.  For example, I could issue the command “show run | include address”.  The entire output of the running-config would be piped out to the include command and filtered against “address”.  So I would expect to see output similar to the following.

MyRTR#show run | inc address

 ip address 1.1.1.1 255.255.255.0
 ip address 2.2.2.2 255.255.255.0
 ip address 10.1.1.1 255.255.255.0

I could also get fancy with the filter that I am using.  I could use wildcards that are similar to regex.

//all instances of “address”
 MyRTR#show run | inc address
 ip address 1.1.1.1 255.255.255.0
 ip address 2.2.2.2 255.255.255.0
 ip address 10.1.1.1 255.255.255.0

//all instances of address with a space, a single character, then a period
 // the “.” In the filter is a wildcard and a “\.” matches a “.”–confusing
 MyRTR#show run | inc address .\.
 ip address 1.1.1.1 255.255.255.0
 ip address 2.2.2.2 255.255.255.0
 //notice we don’t see 10.1.1.1

The following characters have special meaning in regex and in the filter syntax.

 . (Period) Any Single Character : 임의의 단일문자
 * A multiplier that matches 0 or more sequences of the preceding character
 + A multiplier that matches 1 or more sequences of the preceding character
 ? A multiplier that matches 0 or 1 sequences of the preceding character
 ^ Matches the start of a line
 $ Matches the end of a line
 _ Matches Word Boundaries

If you need to match any of these characters, you must escape them in your filter by using a “\.”  To quickly see the effect of this issue the following two commands on a router.

MyRTR#show run | inc .
 Building configuration…
 Current configuration : 740 bytes
 !
 version 12.3
 service timestamps debug datetime msec
 service timestamps log datetime msec
 no service password-encryption
 !
 hostname MyRTR
 !
 boot-start-marker
 boot-end-marker
 !

< — Snip (it shows everything — >

MyRTR#show run | inc \.
 Building configuration…
 version 12.3
 ip address 1.1.1.1 255.255.255.0
 ip address 2.2.2.2 255.255.255.0
 ip address 10.1.1.1 255.255.255.0
  


'General' 카테고리의 다른 글

키보드 자판 부호 이름  (0) 2016.04.15
HSRP or VRRP 설정  (0) 2013.02.06
Posted by it-infra
,

   

<http://studioxga.net/505>에서 삽입

'General' 카테고리의 다른 글

Cisco IOS multiple pipe  (0) 2018.07.21
HSRP or VRRP 설정  (0) 2013.02.06
Posted by it-infra
,

   

Do you need to use the clientless SSLVPN portal?

Anyconnect Essentials Licenses will be fine.

L-ASA-AC-E-55xx=

where xx is the hardware model.

   

Example: L-ASA-AC-E-5510= for an ASA5510.

This will give you Y concurrent any connect sessions where Y is the maximum number supported by the hardware platform.

For example 250 for an ASA5510.

You must have Anyconnect Premium licenses.

Decide how many concurrent sessions (Anyconnect + portal) you need to support.

The fixed options are 10, 25, 50, 100, 250, 500, 750, 1000, 2500, 5000 and 10000.

   

Note! you cannot add more licences than the hardware supports! (for example 250 for a ASA 5510).

Have you added Premium licenses to the firewall before?

Buy licenses L-ASA-SSL-xx-yy=

where xx is the current number of premium licenses in the box and yy is the number of licenses you want to have.

Example: L-ASA-SSL-100-250= to upgrade from 100 to 250 concurrent sessions.

Note! This license is the same for all hardware platforms.

Need for Advanced Endpoint Assessment?

Not sure? The answer is probably No.

Buy licenses L-ASA5500-SSLxx

where xx is the number of concurrent sessions to support.

Example: L-ASA5500-SSL10 or L-ASA5500-SSL2500.

Add ASA-ADV-END-SEC=

   

Need anyconnect support for mobile devices like iPhones, iPads, Android-devices?

Add L-ASA-AC-M-55xx=

where xx is the hardware model.

Example: L-ASA-AC-M-5510 for an ASA5510.

No matter if you use Premium or Essentials licensing, mobile devices will also be supported and will be included in the overall license counting of Essentials/Premium limits

   

원본 위치 <http://nat0.net/cisco-asa-anyconnect-licensing-for-dummies/>

Posted by it-infra
,