09-08-2020 07:29 PM
I am trying to create a regular expression that will filter just the section of the port given the last numbers of the serial number using the command sh lldp neighbor med inventory
I have the following output:
Port: 1/3 Index: 48 Time: 0 days, 00:02:32
ChassisId: Network address IPv4 x.x.x.x
PortId: MAC address 00:00:00:00:00:00
SysName: xxxxxxxxx
SysCap: TB / B (Supported/Enabled) HWRev: 9620D02L FWRev: hb96xxua3_1_02_S.bin
SWRev: ha96xxua3_1_02_S.bin SerialNumber: 10FA00001231
ManufName: Avaya ModelName: 9620
AssetID:
-------------------------------------------------------------------------------
Port: 2/5 Index: 53 Time: 0 days, 00:02:32
ChassisId: Network address IPv4 x.x.x.x
PortId: MAC address 00:00:00:00:00:00
SysName: x.x.x.x
SysCap: TB / B (Supported/Enabled) HWRev: 9620D02L FWRev: hb96xxua3_1_02_S.bin
SWRev: ha96xxua3_1_02_S.bin SerialNumber: 10FA00001234
ManufName: Avaya ModelName: 9620
AssetID:
-------------------------------------------------------------------------------
Port: 3/40 Index: 54 Time: 0 days, 00:02:33
ChassisId: Network address IPv4 x.x.x.x
PortId: MAC address 00:00:00:00:00:00
SysName: x.x.x.x
SysCap: TB / B (Supported/Enabled) HWRev: 9620D02L FWRev: hb96xxua3_1_02_S.bin
SWRev: ha96xxua3_1_02_S.bin SerialNumber: 10FA00001235
ManufName: Avaya ModelName: 9620
AssetID:
-------------------------------------------------------------------------------
I would like to show the port for the serial number tat ends with 001234. So I would like the following output:
Port: 2/5 Index: 53 Time: 0 days, 00:02:32
ChassisId: Network address IPv4 x.x.x.x
PortId: MAC address 00:00:00:00:00:00
SysName: x.x.x.x
SysCap: TB / B (Supported/Enabled) HWRev: 9620D02L FWRev: hb96xxua3_1_02_S.bin
SWRev: ha96xxua3_1_02_S.bin SerialNumber: 10FA00001234
ManufName: Avaya ModelName: 9620
AssetID:
-------------------------------------------------------------------------------
So far I have tried the following regex expression, but it doesn’t display anything:
sh lldp neighbor med inventory | find /Port.001234/
Solved! Go to Solution.
09-25-2020 08:59 AM
Roc156, Dilraj,
ERS is running on VxWorks with a limited support on regex expressions.
We cannot match the standard “\n” so the dirty solution I have is the following regex:
sh lldp neighbor med inventory | match "(Port: .+\/.+).+|SerialNumber: .+1234"
Regards
Mig
09-23-2020 02:39 PM
Did it work for you?
09-14-2020 12:41 AM
I don’t think you can do a direct regex search on the CLI. You might want to copy the output and put it is some word editor like Notepad++ and try it there.
09-13-2020 04:16 PM
I ran the command sh lldp neighbor med inventory | find Port: \d+\/\d+.*\n.*\n.*\n.*\n.*\n.*SerialNumber: \S+001234\n.*\n.* , but got an Invalid input detected at the first \d after Port: .
09-12-2020 05:21 AM
Try this:
Port: \d+\/\d+.*\n.*\n.*\n.*\n.*\n.*SerialNumber: \S+001234\n.*\n.*
09-10-2020 12:58 AM
I am testing specifically on a 4950GTS-PWR+ with SW version 7.7.1