03-06-2013 09:37 AM - edited 03-11-2019 06:10 PM
Couple questions on show with include
1. Can you do a show command with include and a space meaning can you search for say "permit ip"?
2. Can you do a search for an exclude say "show access-list | exclude eq"?
03-06-2013 09:41 AM
The answer to both questions is YES.
03-06-2013 09:43 AM
Forgot to mention that you can also use a second pipe as a OR in your expression.
03-06-2013 10:01 AM
Heh - ok - I was more interested in what the examples would look like. I feel a bit silly for the second question...I guess I never paid any attention to the options after a pipe... so I see you can do a pipe exclude but how do you do the include for words and spaces?
Can you do a show command for access-list where you are looking for permit IP without "eq"?
03-06-2013 10:33 AM
Hi,
I dont think any "access-list" line that has "permit ip" has an "eq" as those are only used with either UDP or TCP only permit statements that have/use ports.
If on the other hand you are talking about looking for ACL lines that allow UDP or TCP without any port restrictions then this might work
ACL lines with "permit tcp" without "eq"
show access-list
ACL lines with "permit udp" without "eq"
show access-list
EDIT: The above doesnt filter every possible other line from the output though, depending on your ACL configuration.
- Jouni
03-06-2013 10:34 AM
Sure, examples:
How do you do the include for words and spaces?
When filtering you can use the underscore to refer to spaces on the lines.
Can you do a show command for access-list where you are looking for permit IP without "eq"?
You can't mix commands like, mixing "inc" & "exc". So no.
Besides, the only available option when using two or more pipes is only OR, in case you were wondering.
Now, examples
show run access-list test
access-list test remark hello world
access-list test remark helloworld
access-list test remark hey hello world
access-list test remark heyhelloworld
Now, filtering:
show runnaccess-list | i hello
access-list test remark hello world
access-list test remark helloworld
access-list test remark hey hello world
access-list test remark heyhelloworld
show run access-list | i _world
access-list test remark hello world
access-list test remark hey hello world
show run access-list | i hey | world
access-list test remark hello world
access-list test remark hey hello world
I think that covers it.
Here is a good articule about the topic:
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide