Comware-Based
cancel
Showing results for 
Search instead for 
Did you mean: 

Using the pipe command on comware 7

SOLVED
Go to solution
forde1208
Regular Visitor

Using the pipe command on comware 7

Hi Guys,

any help would be great.

When using some commands on a well known rival vendors switches, i can use the pipe command and multiple cirteria when carrying out the search - example: sh int | i down|0 packets input,|0 packets output,

It allows me to see what ports are down without any traffic inbound or outbound on the interface.

If I try a similar command on HPE comware 7, i get an error on the first space after the first pipe - example: dis int | i Input (total):  0 

the following error occurs when the first space is discovered  % Too many parameters found at '^' position.

am i missing something?

Thanks in advance.

4 REPLIES
forde1208
Regular Visitor

Re: Using the pipe command on comware 7

Wow 80 plus views, is this a limitation within comware?  

any help grately appreciated.

VoIP-Buddy
Trusted Contributor

Re: Using the pipe command on comware 7

Forde,

After the | include, if the search term has a space or other special character like the paren in it you need to quote it with a back slash.  So to do what you want, the Regular Expression would look like this...

disp interface | include "Input\ \(total\):\ \ 0"

For information on the Regular Expression support in Comware 7, check out the Comware Fundamentals Configuration Guide.  In the version I have the section is entitled as Filtering the output from a display command.

Regards,

David

Highlighted
sdide
Trusted Contributor
Solution

Re: Using the pipe command on comware 7

Hi,

I think the alternation operator "|" as a special character in the regular expression argument to the  include command - works just fine.

Below is a full view of Gi1/0/3 on a random 5130,

[HP-5130-24G]display interface Gi1/0/3
GigabitEthernet1/0/3
Current state: DOWN
Line protocol state: DOWN
IP packet frame type: Ethernet II, hardware address: bcea-fa00-cadc
Description: GigabitEthernet1/0/3 Interface
Bandwidth: 1000000 kbps
Loopback is not set
Media type is twisted pair
Port hardware type is 1000_BASE_T
Unknown-speed mode, unknown-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
Maximum frame length: 12288
Allow jumbo frames to pass
Broadcast max-ratio: 100%
Multicast max-ratio: 100%
Unicast max-ratio: 100%
PVID: 1
MDI type: Automdix
Port link-type: Access
 Tagged VLANs:   None
 Untagged VLANs: 1
Port priority: 0
Last link flapping: Never
Last clearing of counters: Never
 Peak input rate: 0 bytes/sec, at 2017-03-13 13:41:35 
 Peak output rate: 0 bytes/sec, at 2017-03-13 13:41:35 
 Last 300 second input: 0 packets/sec 0 bytes/sec -%
 Last 300 second output: 0 packets/sec 0 bytes/sec -%
 Input (total):  0 packets, 0 bytes
	 0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
 Input (normal):  0 packets, - bytes
	 0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
 Input:  0 input errors, 0 runts, 0 giants, 0 throttles
	 0 CRC, 0 frame, - overruns, 0 aborts
	 - ignored, - parity errors
 Output (total): 0 packets, 0 bytes
	 0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
 Output (normal): 0 packets, - bytes
	 0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
 Output: 0 output errors, - underruns, - buffer failures
         0 aborts, 0 deferred, 0 collisions, 0 late collisions
	 0 lost carrier, - no carrier

Lets say I want "interface name", "Current State", "Input Total", and "output total" lines for all Gigabit interfaces.

Remember its a regular expression your include command takes as input. 

display interface | incl "^GigabitEthernet|^Current\ state|^\ Input\ \(total\)|^\ Output\ \(total\)"

First remember the statement needs to be within "-signs

Space and parathesis "(" and ")" needs to be escaped with a "\",

"^" means the beginning of a line.

The output is

[HP-5130-24G]display interface | incl "^GigabitEthernet|^Current\ state|^\ Input\ \(total\)|^\ Output\ \(total\)"
Current state: DOWN
GigabitEthernet1/0/1
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/2
Current state: Administratively DOWN
 Input (total):  2483 packets, 326392 bytes
 Output (total): 12879 packets, 1401644 bytes
GigabitEthernet1/0/3
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/4
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/5
Current state: UP
 Input (total):  26148069 packets, 2642866455 bytes
 Output (total): 6658835 packets, 2890783135 bytes
GigabitEthernet1/0/6
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/7
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/8
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/9
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/10
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/11
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/12
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/13
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/14
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/15
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/16
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/17
Current state: UP
 Input (total):  473407 packets, 42881165 bytes
 Output (total): 2740884 packets, 277286298 bytes
GigabitEthernet1/0/18
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/19
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/20
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/21
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/22
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
GigabitEthernet1/0/23
Current state: DOWN
 Input (total):  140857 packets, 49721943 bytes
 Output (total): 2253634 packets, 184939671 bytes
GigabitEthernet1/0/24
Current state: DOWN
 Input (total):  2253633 packets, 184939607 bytes
 Output (total): 140857 packets, 49721943 bytes
Current state: UP <------ InLoopBack0
Current state: UP <------ NULL0
Current state: UP
 Input (total):  8136443 packets, 2657540509 bytes
 Output (total): 7133480 packets, 656859383 bytes
Current state: UP
 Input (total):  21056246 packets, 1468279175 bytes
 Output (total): 213234579 packets, 15466185115 bytes
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
Current state: DOWN
 Input (total):  0 packets, 0 bytes
 Output (total): 0 packets, 0 bytes
Current state: UP <------ Vlan-interface

as one can see there are some things I haven't accounted for in my expression.

There is a BridgeAggregation interface which precedes the first GigabitEthernet - it is DOWN, and its counters are displayed differently compared to the GigabitEthernet.The BridgeAggregation "Input (total)" and Output (total) are not indented with a single space like it is on the GigabitEthernet... (wonder if this is intended)

Also there are several interfaces (at the end of the output) for which I get a mix of the Counters and State, but not the interface name itself - obvoiusly.   

Regards

Søren Dideriksen, Network Administrator
Region Midtjylland
forde1208
Regular Visitor

Re: Using the pipe command on comware 7

Gentlemen,

 

thank you for your time in helping me, much appreciated.