Cisco – How to – use regex in Nexus to search for this | or that

ciscocisco-nexus-7kcisco-nx-os

So aggravating – i can't find good documentation on how to use the Nexus regex command.

So, if my interfaces look like this:

interface Vlan224
  description MANAGEMENT
  no shutdown
  ip flow monitor netflow-monitor input  
  no ip redirects
  ip address 10.214.224.2/24
  ip ospf passive-interface
  ip router ospf 1 area 0.0.0.3
  ip pim sparse-mode
  hsrp version 2
  hsrp 224 
  preempt 
  priority 120
  ip 10.214.224.1 

I want to run something similar to:

show run | inc (interface Vlan)|(ip address)

And the output to look similar to (if this were on IOS):

interface Vlan10
ip address 10.1.10.1 255.255.255.0
interface Vlan 11
ip address 10.1.11.1 255.255.255.0
etc.

Best Answer

You can do a show run | egrep interface.Vlan|ip.address. It does grab a bit more info, but should provide similar output to what you see in IOS. I think grep might work as well, but I used egrep and got the correct output.