cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2640
Views
0
Helpful
7
Replies

How to use PIPE command to find data in runnin-configuration

DariuszD
Level 1
Level 1

Hi,

Is it possible to extract from the switch configuration with basic cisco IOS commands which switch port has the trunk configured. The idea is that the return data from the given command will be the port number containing the switch port mode trunk in its config. I have tried to do this using show and pipe commands but have not been able to get anything meaningful.

BR

7 Replies 7

Hi

 The best you can to is use PIPE nexted to get information. But, if one interface were configured different from the other, chances are you can not get the config. For example.

sh run | i int|trunk|allow|nativ|mode

 

Thank you for your reply

M02@rt37
VIP
VIP

Hello @DariuszD,

"show interfaces trunk" command ?

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Thank you for your reply . The given command will return the lines containing the "trunk" in the configuration . What I want is to get the port number which has trunk mode in the configuration. I have an active 48 port switch, some ports are configured as access and some as trunk. I would like to use a command to simplify which of these 48 ports are configured as trunk with a specific port number, so that I do not have to search manually in sh run through the port configuration. For example, the command sh run | c trunk will give me the number of ports configured as trunk, but not the number of interfaces which are configured as trunk.

 

@DariuszD,

then show interface status | include trunk should be good !

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Edson A. Hernandez
Spotlight
Spotlight

Yes, it is possible to use the "show" command with the "include" or "section" options, along with the "pipe" command to search for specific information in the running configuration of a Cisco IOS switch.

To find which switch ports have trunk configuration, you can use the following command:

show running-config | include interface|switchport mode trunk

This command will search the running configuration for lines containing the keywords "interface" and "switchport mode trunk", and display only those lines. This will give you a list of all the interfaces that have trunk configuration.

Alternatively, you can use

show interface status | include trunk

This command will display the status of all interfaces on a switch, and to filter the output to show only the interfaces that are configured as trunks.

 

**Remember to support with a like to keep the community active***

show running-config | include interface|switchport mode trunk

This command will search the running configuration for lines containing the keywords "interface" and "switchport mode trunk", and display only those lines

It's actually a logical OR , not AND

Review Cisco Networking for a $25 gift card