Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

IOS Output Modifiers Strange Behaviour

Hi,

Does anyone know why "show inv | exclude PID: " works correctly as below

IHPR10_A_CC375_06#sho inv | e PID:
NAME: "1", DESCR: "WS-C3750-24TS"

NAME: "GigabitEthernet1/0/1", DESCR: "1000BaseSX SFP"

NAME: "GigabitEthernet1/0/2", DESCR: "10/100/1000BaseTX SFP"

but 

"show inv | exclude PID: ,"  doesn't work, see below

IHPR10_A_CC375_06#sho inv | e PID: ,
NAME: "1", DESCR: "WS-C3750-24TS"
PID: WS-C3750-24TS-S   , VID: V05, SN: CAT0931N110

NAME: "GigabitEthernet1/0/1", DESCR: "1000BaseSX SFP"
PID: , VID: 14 , SN: FNS112505E2

NAME: "GigabitEthernet1/0/2", DESCR: "10/100/1000BaseTX SFP"
PID: , VID: 255, SN: AGM163923J5

what is a addition of the "," doing that is stopping the command from working correctly

3 REPLIES
Hall of Fame Super Silver

Even though to our eyes it

Even though to our eyes it looks like the output is PID: , I am pretty sure that in the output there is a null character which represents the empty field and that causes it to not match your string.

 

HTH

 

Rick
 

 

New Member

Hi Rick, thanks for you reply

Hi Rick, thanks for you reply,

Possibly, but the below works

IHPR10_A_CC375_06#sho inv | i PID:          (with a whitepace after the colon)
PID: WS-C3750-24TS-S   , VID: V05, SN: CAT0931N110
PID: , VID: 14 , SN: FNS112505E2
PID: , VID: 255, SN: AGM163923J5

Hall of Fame Super Silver

This is an interesting

This is an interesting question and I do not have an authoritative answer. But I continue to believe that there is something in the output that is a non print character which indicates a field with no content.

 

There is certainly not anything inherent in the comma that is not processed by the regular expression. I set up a test with a line that has whitespace followed by a comma and the show command processed it just as expected

router#show run | inc t ,
 description test , does it find a comma

 

HTH

 

Rick

62
Views
0
Helpful
3
Replies
CreatePlease login to create content