删除某一行,而使用的iperf

问题描述:

我运行iperf的命令是这样的:删除某一行,而使用的iperf

iperf -c 10.0.0.1 -t 2 -f m -w 1K | grep -Po '[0-9.]*(?= Mbits/sec)' 

我想显示的吞吐量只有如0.32,但因为我用1K这里,有一个警告,显示变得

WARNING: TCP window size set to 1024 bytes. A small window size will give poor performance. See the Iperf documentation. 
0.32 

如何删除此警告,以便我只能得到“0.32”?

只需将警告消息发送至/dev/null,之后您只能得到输出。

所以,你的命令是,

iperf -c 10.0.0.1 -t 2 -f m -w 1K 2> /dev/null | grep -Po '[0-9.]*(?= Mbits/sec)' 
+0

你是什么意思发送到/ dev/null的这里是什么意思?如何通过bash脚本发送? – user2290560

+0

'command 2>/dev/null',这将删除警告消息并仅打印输出。 –

+0

我这样使用:iperf -c 10.0.0.1 -t 2 -f m -w 1K 2>/dev/null | grep -Po'[0-9。] *(?= Mbits/sec)',它可以工作。谢谢 – user2290560